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

iconoir-react-native - Expo main module field that could not be resolved #503

Open
mikitovicsmark opened this issue Jan 14, 2025 · 0 comments

Comments

@mikitovicsmark
Copy link

With a clean create-expo-app I added iconoir-react-native and got the following error:

While trying to resolve module `iconoir-react-native` from file `project_path/app/(tabs)/_layout.tsx`, the package `project_path/node_modules/iconoir-react-native/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`project_path/node_modules/iconoir-react-native/dist/esm/index.js`. Indeed, none of these files exist:

  * project_path/node_modules/iconoir-react-native/dist/esm/index.js(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)
  * project_path/node_modules/iconoir-react-native/dist/esm/index.js/index(.web.ts|.ts|.web.tsx|.tsx|.web.mjs|.mjs|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)

I've tried adding .mjs extension to metro.config, but that didn't help.

I've noticed the following line

"module": "dist/esm/index.js",

in reality this is dist/esm/index.mjs not .js

When overwriting it to .mjs it works fine, and I no longer get the error message.

Is this a mistake or am I missing something ?
Thanks!

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

No branches or pull requests

1 participant