Skip to content

Implement hideSourceMaps in all meta frameworks #13613

Description

@andreiborza

Problem Statement

As identified in getsentry/sentry-docs#9557, we currently don't document that sourcemaps do not have to be shipped to production. It also shows that the nextjs SDK has an option hideSourceMaps to hide source maps (albeit it not actually being used anywhere 😅 ).

/**
* Use `hidden-source-map` for webpack `devtool` option, which strips the `sourceMappingURL` from the bottom of built
* JS files.
*/
hideSourceMaps?: boolean;

// `hidden-source-map` produces the same sourcemaps as `source-map`, but doesn't include the `sourceMappingURL`
// comment at the bottom. For folks who aren't publicly hosting their sourcemaps, this is helpful because then
// the browser won't look for them and throw errors into the console when it can't find them. Because this is a
// front-end-only problem, and because `sentry-cli` handles sourcemaps more reliably with the comment than
// without, the option to use `hidden-source-map` only applies to the client-side build.
newConfig.devtool =
isServer || userNextConfig.productionBrowserSourceMaps ? 'source-map' : 'hidden-source-map';
}

Solution Brainstorm

Add a hideSourceMaps option to all meta frameworks that support bundleSizeOptimizations and abide by it.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions