Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable source maps in production (v2) #3818

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions packages/gatsby/src/utils/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ({ actions, stage }) => {
// switch (stage) {
// case `build-html`:
// case 'build-javascript':
// actions.setWebpackConfig({
// devtool: 'source-map'
// })
// }
// }
default:
return false
}
Expand Down