Skip to content

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

Open
@mikitovicsmark

Description

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions