getsentry / sentry

Developer-first error tracking and performance monitoring
https://sentry.io
Other
38.95k stars 4.18k forks source link

React Sentry hideSourceMap #78114

Open richhapal opened 4 weeks ago

richhapal commented 4 weeks ago

Environment

SaaS (https://sentry.io/)

What are you trying to accomplish?

I want to hide source map from devtools.

How are you getting stuck?

There is not key to hide sourcemap in react sentry like sentry/next. I'm able to see source code from devtool. this is current script-> "build": " react-scripts build && yarn sentry:sourcemaps",

now i want that GENERATE_SOURCEMAP=false so how to hide sourceMap in react sentry

Where in the product are you?

Issues - Source Maps

Link

No response

DSN

No response

Version

No response

getsantry[bot] commented 4 weeks ago

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] commented 4 weeks ago

Routing to @getsentry/product-owners-issues-source-maps for triage ⏲️

chargome commented 4 weeks ago

Hi @richhapal, did you check https://docs.sentry.io/platforms/javascript/guides/react/sourcemaps/uploading/create-react-app/#manual-setup? Also, what does yarn sentry:sourcemaps point to?

richhapal commented 1 week ago

hi @chargome yarn sentry:sourcemap point to this script "sentry:sourcemaps": "sentry-cli sourcemaps inject --org physics-wallah-nn --project pw-video-player-fe-react ./build && sentry-cli sourcemaps upload --org physics-wallah-nn --project pw-video-player-fe-react ./build"

richhapal commented 1 week ago

Hi @chargome .map file are not generating

Image

chargome commented 1 week ago

@richhapal can you confirm that you are using plain create-react-app for your project? Also when inspecting your build output, do you see any .js.map files?

richhapal commented 1 week ago

@chargome yes, we are using create-react-app. but there no .js.map file inside build folder. bcz we are using GENERATE_SOURCEMAP=false so can you tell me any other method to hide sourcemap. One method i'm using GENERATE_SOURCEMAP=true react-scripts build && yarn sentry:sourcemaps && find ./build -name '*.map' -delete" but it's not a good way

chargome commented 1 week ago

With the bare react-scripts I'm not aware if there is a better option, you will need to turn sourcemap on in order to upload them – and in your case delete them manually afterwards.

If you want to make use of one of our bundler plugins this will all be done automatically. If you want to do that you could e.g. switch to vite or eject and update your webpack config in order to use our webpack plugin.