-
Notifications
You must be signed in to change notification settings - Fork 479
Description
What happened?
When upgrading from 2.1.0 to either 2.1.1 or 2.1.2, I get the following build error from webpack:
`ERROR in ./node_modules/@react-native-async-storage/async-storage/lib/module/index.js 3:0-42
Module not found: Error: Can't resolve './AsyncStorage' in '.../node_modules/@react-native-async-storage/async-storage/lib/module'
Did you mean 'AsyncStorage.js'?
BREAKING CHANGE: The request './AsyncStorage' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
resolve './AsyncStorage' in '.../node_modules/@react-native-async-storage/async-storage/lib/module'
using description file: .../node_modules/@react-native-async-storage/async-storage/lib/module/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: .../node_modules/@react-native-async-storage/async-storage/lib/module/package.json (relative path: ./AsyncStorage)
Field 'browser' doesn't contain a valid alias configuration
...node_modules/@react-native-async-storage/async-storage/lib/module/AsyncStorage doesn't exist
@ ./src/store/basePersistConfig.web.ts 1:376-428
@ ./src/store/index.ts 1:512-542
@ ./src/booting/App.tsx 1:599-618
@ ./index.web.js 1:209-237
ERROR in ./node_modules/@react-native-async-storage/async-storage/lib/module/index.js 4:0-42
Module not found: Error: Can't resolve './hooks' in '.../node_modules/@react-native-async-storage/async-storage/lib/module'
Did you mean 'hooks.js'?
BREAKING CHANGE: The request './hooks' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '.mjs' file, or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
resolve './hooks' in '...node_modules/@react-native-async-storage/async-storage/lib/module'
using description file: .../node_modules/@react-native-async-storage/async-storage/lib/module/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: .../node_modules/@react-native-async-storage/async-storage/lib/module/package.json (relative path: ./hooks)
Field 'browser' doesn't contain a valid alias configuration
.../node_modules/@react-native-async-storage/async-storage/lib/module/hooks doesn't exist
@ ./src/store/basePersistConfig.web.ts 1:376-428
@ ./src/store/index.ts 1:512-542
@ ./src/booting/App.tsx 1:599-618
@ ./index.web.js 1:209-237`
Version
2.1.2
What platforms are you seeing this issue on?
- AndroidiOSmacOSWindowswebTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
System Information
System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M2 Pro
Memory: 262.83 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.15.0
path: /usr/local/bin/node
Yarn: Not Found
npm:
version: 10.9.2
path: /usr/local/bin/npm
Watchman:
version: 2025.04.28.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /Users/alexandergyllensvard/.rvm/gems/ruby-3.3.7/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.4
- iOS 18.4
- macOS 15.4
- tvOS 18.4
- visionOS 2.4
- watchOS 11.4
Android SDK: Not Found
IDEs:
Android Studio: 2024.3 AI-243.24978.46.2431.13363775
Xcode:
version: 16.3/16E140
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.15
path: /usr/bin/javac
Ruby:
version: 3.3.7
path: /Users/alexandergyllensvard/.rvm/rubies/ruby-3.3.7/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: ^18.0.0
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.2
wanted: 0.79.2
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Steps to Reproduce
- Set up react-native-web with webpack
- Build for web
Activity
JDansercoerTwipe commentedon May 8, 2025
Can confirm that this also happens when building with Vite
pedrogarciyalopez commentedon May 14, 2025
Has anyone found a solution yet?
joker-777 commentedon Jun 24, 2025
I also have similar issues when using webpack.
dmitry-markevich commentedon Jun 24, 2025
For me the solution was setting the
fullySpecified: false
flag in the webpack configjoker-777 commentedon Jun 25, 2025
Actually, my solution didn't work. I was able to prevent the errors by adding
to my include list of the babel-loader configuration but then I get the following error in my browser console
joker-777 commentedon Jun 25, 2025
I created a simple test app where you can test it. @tido64 I would appreciate your help.
joker-777 commentedon Jun 26, 2025
@dmitry-markevich Yes, adding the following rule to the webpack config fixed it.
kapir commentedon Jul 28, 2025
Also experiencing this issue on webpack.
I fixed it by adding this to the alias option for "module-resolver" in my webpack config
'@react-native-async-storage/async-storage':
'@react-native-async-storage/async-storage/lib/commonjs/index.js',