From 875d4cf3567d24d8ec312310ac33000ad791da5e Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Tue, 30 Aug 2022 12:41:22 -0700 Subject: [PATCH] ref(nextjs): Default to hiding source maps in nextjs config (#188) This adds a default value for `hideSourceMaps` to the `next.config.js` the wizard provides, so that new users will use `hidden-source-map` as their Webpack `devtool` by default in client-side builds. (This prevents browser devtools from seeing sourcemaps and therefore prevents original source code from showing up automatically in the `Sources` tab. (More information on `devtool` values can be found at https://webpack.js.org/configuration/devtool/.) In conjunction with https://github.com/getsentry/sentry-javascript/pull/5649, https://github.com/getsentry/sentry-docs/pull/5464, and https://github.com/vercel/next.js/pull/40079, this is the first step in addressing the concerns raised in https://github.com/getsentry/sentry-javascript/issues/4489. See https://github.com/getsentry/sentry-javascript/issues/4489#issuecomment-1231137629 for more details. --- scripts/NextJs/configs/next.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/NextJs/configs/next.config.js b/scripts/NextJs/configs/next.config.js index 6b43f132..06ef151f 100644 --- a/scripts/NextJs/configs/next.config.js +++ b/scripts/NextJs/configs/next.config.js @@ -7,6 +7,16 @@ const { withSentryConfig } = require('@sentry/nextjs'); const moduleExports = { // Your existing module.exports + + sentry: { + // Use `hidden-source-map` rather than `source-map` as the Webpack `devtool` + // for client-side builds. (This will be the default starting in + // `@sentry/nextjs` version 8.0.0.) See + // https://webpack.js.org/configuration/devtool/ and + // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map + // for more information. + hideSourceMaps: true, + }, }; const sentryWebpackPluginOptions = {