react-error-boundary: Can't find module entry since v6
Hi! I’m trying to build without success my app with the v6 but the bundler seems to don’t find the entry :
ERROR Error: While trying to resolve module `react-error-boundary` from file `/Users/user/core/src/components/ErrorBoundaryCatcher/ErrorBoundaryCatcher.tsx`, the package `/Users/user/core/node_modules/react-error-boundary/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/user/core/node_modules/react-error-boundary/index`.
Any idea?
It is a react-native project.
Thank you.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 7
- Comments: 15 (6 by maintainers)
I had this issue too when using Parcel. I had to enable
packageExportsfor the resolver. I thought this was strange as I’ve never had an issue with any package in the last couple years with Parcel. I’m guessing most libraries use bothexportsand themainfield.For anyone wondering, the change log says that the only change between v5 and v6 is using ESModules + Exports. So yes, sticking with v5 is a totally viable approach.
I’m having the same issue but with a standard react web app.
Hello guys,
I’ve spent some time on that and looks like
react-error-boundaryworks just fine. The problem is howeslint-plugin-import(ruleimport/no-unresolved) reacts on ES-only modules. I mean, UNLESS your project supports ES modules. See https://github.com/import-js/eslint-plugin-import/issues/2331#issuecomment-997417550. So, the way to makeeslint-plugin-importnot to complain is to add ES-only packages to the ignore list.Possibly there are alternatives for
eslint-plugin-import, but I haven’t dug into it yet.Yeah @TomCorvus, that’s unfortunate. But in this case you aren’t missing out on anything by sticking with version 5. Same features. This package has been stable for a long time, feature wise.
Hello, same here on standard react app project.
import { ErrorBoundary } from 'react-error-boundary'It seems that Hermes doesn’t support natively ESM. On my side, I need to modify Metro config and enable
unstable_enablePackageExportslike this:config.resolver.unstable_enablePackageExports = trueMaybe one day: https://github.com/facebook/hermes/discussions/1391