Packages specifies a `main` module field that could not be resolved
Skn0tt opened this issue · comments
As reported in blitz-js/superjson#190, there seems to be an issue with this packages's CJS distribution + React Native Bundling:
While trying to resolve module `copy-anything` from file `/Users/mike/batcave/movida/apps/mobile/node_modules/superjson/dist/index.js`, the package `/Users/mike/batcave/movida/node_modules/copy-anything/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/mike/batcave/movida/node_modules/copy-anything/dist/index.cjs`. Indeed, none of these files exist:
* /Users/mike/batcave/movida/node_modules/copy-anything/dist/index.cjs(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
* /Users/mike/batcave/movida/node_modules/copy-anything/dist/index.cjs/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
*
I'm not sure what's causing this - @mesqueeb do you have an idea? Would be happy to provide a PR fixing this, if it helps.
I'm not sure either 🤔
@Skn0tt based on the files the build tools says it looked through, I don't believe it's setup properly to detect .cjs files
Most likely an issue that is to be resolved at the build tool side.
Vite works fine btw! Highly suggest giving Vite a try.
Thanks for looking into it! The original reports found a fix: blitz-js/superjson#190 (comment)