expo: expo-notifications error on import with Expo 48
Minimal reproducible example
https://drive.google.com/file/d/1CRAdNhFnUNTXdtY0it0RR8ldGl96QNt_/view?usp=sharing
Summary
When you import expo-notifications using the following line:
import * as Notifications from 'expo-notifications';
You get the following error on console:
ERROR in ./node_modules/abort-controller/polyfill.mjs:2
Module not found: Can't resolve './dist/abort-controller'
Did you mean 'abort-controller.mjs'?
BREAKING CHANGE: The request './dist/abort-controller' 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.
1 | /*globals self, window */
> 2 | import * as ac from "./dist/abort-controller"
3 |
4 | /*eslint-disable @mysticatea/prettier */
5 | const g =
Environment
expo-env-info 1.0.5 environment info: System: OS: macOS 13.2 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm Watchman: 2023.02.13.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 14.2/14C18 - /usr/bin/xcodebuild npmGlobalPackages: eas-cli: 3.7.2 expo-cli: 6.1.0 Expo Workflow: managed
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 22
I fixed it by adding the following rule to the webpack config rules.
{ test: /.m?js/, resolve: { fullySpecified: false, }, }
in more detail like below. config.module.rules.push({ test: /.m?js/, resolve: { fullySpecified: false, }, })
This works for me:
the above does fix it for me as well