From 450ee655a75fabf11b9bea7034d8aaf202083af2 Mon Sep 17 00:00:00 2001 From: tomazy Date: Thu, 1 Feb 2018 22:49:55 -0500 Subject: [PATCH 1/2] Disable source maps in production Fixes #3817 --- packages/gatsby/src/utils/webpack.config.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index 3e725a59c9d93..2defd91fe0f65 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -316,12 +316,27 @@ module.exports = async ( switch (stage) { case `develop`: return `cheap-module-source-map` - // use a normal `source-map` for the html phases since + // use a normal `source-map` for the develop-html phase since // it gives better line and column numbers case `develop-html`: - case `build-html`: - case `build-javascript`: return `source-map` + + // Source maps expose too much information about the site so + // we don't generate them by default. + // + // You can easily enable them in your `gatsby-node.js` but make + // sure that your web server restricts access to them (e.g. with + // basic auth): + // + // exports.modifyWebpackConfig = ({ config, stage }) => { + // switch (stage) { + // case `build-html`: + // case 'build-javascript': + // config.merge({ + // devtool: 'source-map' + // }) + // } + // } default: return false } From 794ecdfe2dd5f2b8aaf56174ac1d069be8702f01 Mon Sep 17 00:00:00 2001 From: tomazy Date: Fri, 2 Feb 2018 16:23:55 -0500 Subject: [PATCH 2/2] Updated comment to use the new API --- packages/gatsby/src/utils/webpack.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/src/utils/webpack.config.js b/packages/gatsby/src/utils/webpack.config.js index 2defd91fe0f65..6a0ffc7c5d4ff 100644 --- a/packages/gatsby/src/utils/webpack.config.js +++ b/packages/gatsby/src/utils/webpack.config.js @@ -328,11 +328,11 @@ module.exports = async ( // sure that your web server restricts access to them (e.g. with // basic auth): // - // exports.modifyWebpackConfig = ({ config, stage }) => { + // exports.modifyWebpackConfig = ({ actions, stage }) => { // switch (stage) { // case `build-html`: // case 'build-javascript': - // config.merge({ + // actions.setWebpackConfig({ // devtool: 'source-map' // }) // }