electrode-io / electrode-native

A platform to ease integration&delivery of React Native apps in existing mobile applications
https://native.electrode.io
Other
723 stars 113 forks source link

Add `.cjs` support in the generated Metro config #1892

Closed leonardlib closed 1 year ago

leonardlib commented 1 year ago

Hi, I have an issue while trying to bundle my miniapp with an external .cjs module and I figured out that you should add that file extension in the generated metro config file.

Here is my error:

✖ error While trying to resolve module <module-name> from file <file-name>, the 
package `<package>/package.json` was successfully found. However, this package 
itself specifies a `main` module field that could not be resolved (`<package>/index.cjs`. 
Indeed, none of these files exist:
✖
✖   * <package>/index.cjs(.native|.ios.js|.native.js|.js|.ios.json|.nati
ve.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)
✖   * <package>/index.cjs/index(.native|.ios.js|.native.js|.js|.ios.json
|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.svg|.native.svg|.svg)