-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
When importing recoil package, which clearly has a specified react-native entry point, the following error appears:
Error: Cannot find module 'react-dom'
Require stack:
- /Users/wmaj/Projekty/Rewardo/app-native/node_modules/recoil/cjs/index.js
❯ node_modules/recoil/cjs/index.js:8:32
6|
7| var react = _interopDefault(require('react'));
8| var reactDom = _interopDefault(require('react-dom'));
| ^
9|
10| /**
By adding the following to the config:
resolve: {
alias: [{ find: 'recoil', replacement: 'recoil/native/index.js' }],
},
test: {
deps: {
inline: ['recoil'],
},
},
everything works again.
Looking at https://vitejs.dev/config/shared-options.html#resolve-conditions docs, it seems like this would extend the list of conditions, so react-native would still not be prioritized. Or, perhaps, it works for exports only.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels