Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React Native] [1.1.0-beta.8] main module field that could not be resolved #1614

Closed
beetlebum opened this issue Nov 4, 2021 · 1 comment · Fixed by #1618
Closed

[React Native] [1.1.0-beta.8] main module field that could not be resolved #1614

beetlebum opened this issue Nov 4, 2021 · 1 comment · Fixed by #1618

Comments

@beetlebum
Copy link

error: Error: While trying to resolve module swr from file /project/src/core/api/common/ApiConfig.tsx, the package /project/node_modules/swr/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/project/node_modules/swr/dist/index.mjs. Indeed, none of these files exist:

  • /project/node_modules/swr/dist/index.mjs(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
  • /project/node_modules/swr/dist/index.mjs/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
    at DependencyGraph.resolveDependency (/project/node_modules/metro/src/node-haste/DependencyGraph.js:311:17)
    at Object.resolve (/project/node_modules/metro/src/lib/transformHelpers.js:129:24)
    at resolve (/project/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
    at /project/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
    at Array.reduce ()
    at resolveDependencies (/project/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
    at processModule (/project/node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)
    at async addDependency (/project/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
    at async Promise.all (index 0)
    at async processModule (/project/node_modules/metro/src/DeltaBundler/traverseDependencies.js:198:5)
@huozhi
Copy link
Member

huozhi commented Nov 4, 2021

Looks like metro currently doesn't support .mjs as source file extension
facebook/metro#535

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants