You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Performing a self-referring subpath import (i.e. import "my-lib/some-sub-path") from within a package (in this example "my-lib") while the package is considered a haste module (included in watchFolders) I'm experiencing the following error:
Error: Unable to resolve module my-lib/subpath from /Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-lib/index.js: my-lib/subpath could not be found within the project.
> 1 | import { greeting } from "my-lib/subpath";
| ^
2 | console.log(greeting);
3 |
at ModuleResolver.resolveDependency (/Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:138:15)
at DependencyGraph.resolveDependency (/Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/node-haste/DependencyGraph.js:231:43)
at /Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/lib/transformHelpers.js:156:21
at resolveDependencies (/Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:42:25)
at visit (/Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:83:30)
at async Promise.all (index 0)
at async visit (/Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:92:5)
at async Promise.all (index 0)
at async buildSubgraph (/Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/DeltaBundler/buildSubgraph.js:103:3)
at async Graph._buildDelta (/Users/kraen.hansen/Projects/metro-self-ref-subpath-issue/my-app/node_modules/metro/src/DeltaBundler/Graph.js:157:22)
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.
Do you want to request a feature or report a bug?
I'd like to report a bug.
What is the current behavior?
Performing a self-referring subpath import (i.e.
import "my-lib/some-sub-path"
) from within a package (in this example "my-lib") while the package is considered a haste module (included inwatchFolders
) I'm experiencing the following error:If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can
yarn install
andyarn test
.npm install
(yarn doesn't create a symlink for the "../my-lib" dependency of "my-app").npm test
to observe the error above.What is the expected behavior?
I would expect the subpath to resolved, just as if the
my-app/index.js
file is updated toimport "my-lib/subpath"
directly.Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
node -v
v20.10.0npm -v
10.2.3Additional information
This bug feels related to #1128, as that was also dealing with subpath exports and haste modules.
The text was updated successfully, but these errors were encountered: