Skip to content
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

getDefaultConfig from expo/metro-config compromise the sourceMappingURL and it has a wrong hash when exported for web platform #3663

Closed
5 tasks
claudioviola opened this issue Mar 6, 2024 · 12 comments

Comments

@claudioviola
Copy link

OS:

  • Windows
  • [ X] MacOS
  • Linux

Platform:

  • iOS
  • Android
"@sentry/react-native": "^5.17.0",
"expo": "^50.0.3",
"react-native": "0.73.2",
"react-native-web": "~0.19.6",
"@expo/metro-runtime": "~3.1.2",
"react": "18.2.0",
"react-dom": "18.2.0",

Are you using Expo?

  • [X ] Yes
  • No

This is the configuration of my metro.config.js placed in the root folder project

// This replaces `const { getDefaultConfig } = require('expo/metro-config');`
const { getSentryExpoConfig } = require('@sentry/react-native/metro');

// This replaces `const config = getDefaultConfig(__dirname);`
const config = getSentryExpoConfig(__dirname);

module.exports = config;

I have the following issue:

Steps to reproduce:

  • Build the web project by running this command npx expo export -p web --dump-sourcemap
  • check the dist folder

2 files are created
AppEntry-9c58c4463ca3cfc79b6525f9cc37e942.js
AppEntry-9c58c4463ca3cfc79b6525f9cc37e942.js.map

Actual result:
Opening the first file for checking if the sourceMappingURL is correct
Actually the sourceMappingURL is wrong and it contains a different hash for the Javascript bundled file
//# sourceMappingURL=/_expo/static/js/web/AppEntry-c20e66115809b9d51b0088b809c85f32.js.map

Expected result:

Opening the first file for checking if the sourceMappingURL is correct
the sourceMappingURL should contains the correct hash and it should points to the correct file
//# sourceMappingURL=/_expo/static/js/web/AppEntry-9c58c4463ca3cfc79b6525f9cc37e942.js.map

if using in the metro.config.js
const { getDefaultConfig } = require('expo/metro-config');
the issue disappears and the sourceMappingURL contains the correct file

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Mar 6, 2024
@github-project-automation github-project-automation bot moved this to Needs Discussion in Mobile & Cross Platform SDK Mar 6, 2024
@claudioviola claudioviola changed the title getDefaultConfig from expo/metro-config compromise the sourceMappingURL when I export for web platform with a wrong hash getDefaultConfig from expo/metro-config compromise the sourceMappingURL with a wrong hash when exported for web platform Mar 6, 2024
@claudioviola claudioviola changed the title getDefaultConfig from expo/metro-config compromise the sourceMappingURL with a wrong hash when exported for web platform getDefaultConfig from expo/metro-config compromise the sourceMappingURL and it has a wrong hash when exported for web platform Mar 7, 2024
@krystofwoldrich
Copy link
Member

Hi @claudioviola,
thank you for the message,
I was able to reproduce it in our sample app, we will investigate it.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 2 Mar 7, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs Investigation in Mobile & Cross Platform SDK Mar 7, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Investigation to Needs Discussion in Mobile & Cross Platform SDK Mar 8, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Mar 8, 2024
@Fwang36
Copy link
Member

Fwang36 commented Mar 28, 2024

Hey Krystof,

Support received a request in Zendesk from a user with the same issue. Do you have an update for this problem?

Link to Zendesk ticket

@krystofwoldrich
Copy link
Member

Hi @Fwang36,
no updates yet, I'll keep you posted here.

@amir-dropit
Copy link

@krystofwoldrich is it resolved in v5.22.0?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 May 1, 2024
@krystofwoldrich
Copy link
Member

@amir-dropit No, 5.22.0 doesn't fix this particular issue.

@amir-dropit
Copy link

How is this not fixed yet?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 22, 2024
@YishaiGr
Copy link

YishaiGr commented May 22, 2024

@krystofwoldrich can you please update on the manner? our source maps were not uploaded for 3 weeks because of this bug

@krystofwoldrich
Copy link
Member

Hi, I'm sorry to hear that, I've opened a PR fixing this today.

I'll also post here a workaround which you can use until the fix is released.

@YishaiGr
Copy link

Thanks a lot! 🙏

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 22, 2024
@krystofwoldrich
Copy link
Member

Until the fix is released, you can apply the changes from the fix PR using https://www.npmjs.com/package/patch-package

@ricklove
Copy link

ricklove commented Nov 27, 2024

This breaks dynamic modules with React.lazy

@krystofwoldrich
Copy link
Member

This was fixed in expo/expo#30980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Archived in project
Development

No branches or pull requests

6 participants