-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve modules on latest Expo with Metro web #11474
Comments
@damyyyy, was this on a newly built project with Amplify or an older one that was updated to latest version? Can you see if deleting your |
Hi @cwomack, it was on a newly built project, I just cloned this template https://github.com/EvanBacon/expo-router-instagram-layout then installed "aws-amplify amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage". I've tried deleting node_modules along yarn.lock then did yarn install, problem is exactly same: works on mobile, same error for web. It may have something to do with metro |
Thanks for the quick follow up @damyyyy. If the project was cloned from that template, I'm wondering if there's a dependency issue going on. To reproduce on my side, should I just clone that repo first then follow the steps you listed out originally? |
@cwomack, you're welcome
Yes, that's exact. |
@damyyyy, can you share your full |
@cwomack I'm able to reproduce with the following package.json {
"name": "amplify-test",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@react-native-async-storage/async-storage": "1.18.2",
"aws-amplify": "^5.3.3",
"expo": "~49.0.0-beta.3",
"expo-linking": "~5.0.2",
"expo-router": "2.0.0-rc.10",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.1",
"react-native-safe-area-context": "4.6.3",
"react-native-web": "~0.19.6"
},
"devDependencies": {
"@types/react": "~18.0.27",
"typescript": "^4.9.4"
},
"resolutions": {
"metro": "0.76.0",
"metro-resolver": "0.76.0"
},
"private": true
} And a simple index route with import { Text } from "react-native";
import "aws-amplify";
export default function App() {
return <Text>Test</Text>;
}
Thats enough to break the app Reproducible repo at https://github.com/ocho-cesar/amplify-test |
This could solve: add support for config.resolver.sourceExts.push("mjs"); |
Indeed, I can confirm adding this line solved the problem. Thank you @younes0! |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
When running npx expo start, i got the following error when trying to open web:
**_Web Bundling failed 20984ms
Unable to resolve "graphql" from "node_modules/@aws-amplify/api-graphql/lib-esm/GraphQLAPI.js"
Web Bundling failed 114456ms
Unable to resolve "process" from "node_modules/@aws-sdk/client-lex-runtime-service/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js"
Metro error: Unable to resolve module process from /home/d/expo49/node_modules/@aws-sdk/client-lex-runtime-service/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js: process could not be found within the project or in these directories:_**
On mobile (Expo GO) it works as expected and doesn't show the error. It probably comes from the metro for web.
Expected behavior
Expected behavior is that it works fine on web, like on mobile, and doesn't show the error anymore.
Reproduction steps
on expo env:
npm install aws-amplify amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage
create a simple file importing amplify:
import { Auth } from 'aws-amplify';
import { Amplify } from 'aws-amplify';
import awsExports from '@/aws-exports';
Amplify.configure(awsExports);
run "npx expo start" then access http://localhost:19000 on web browser
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: