Description
Core or SDK?
Platform/SDK
Which part? Which one?
Source Maps (JS)
Description
I do want sourcemaps but I do not want to ship them in production. There's no information around this under https://docs.sentry.io/platforms/javascript/sourcemaps/ but for some reason it's only mentioned for the NextJS "platform": https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map:
Depending on your deployment setup, adding
sentry/nextjs
to your app may cause your source code to be visible in browser devtools when it wasn't before. (This happens because of the default behavior of webpack's source-map built-in devtool.) To prevent this, you can usehidden-source-map
rather thansource-map
, which will prevent your built files from containing asourceMappingURL
comment, thus making sourcemaps invisible to the browser. To usehidden-source-map
, add asentry
object tonextConfig
above, and set thehideSourceMaps
option to true: …
I am not using NextJS, but I do use Webpack. I only found this through Github issues after searching for an answer. I think it would help others too that don't use NextJS if this would be fully documented.
Related open issues I found while searching for an answer around this:
- [nextjs] Original source code visible in browser dev tools sentry-javascript#4489
- Uploaded source-map artifacts not working without sourceMappingURL comment sentry#20916
Suggested Solution
- Hoist or also call out that source maps are not required to be shipped in production in the general docs, and that one can configure one's build tooling to keep them hidden, e.g. under https://docs.sentry.io/platforms/javascript/sourcemaps/ or the troubleshooting sub-page perhaps
- Document under each build tool page how to configure for public vs hidden source maps, e.g. for Webpack I'd probably expect a mention about
devtool: 'hidden-source-map'
under this sub-section: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/webpack/#configuration
Metadata
Metadata
Assignees
Type
Projects
Status
Status