I'm struggling how to disable source maps for production since the default Webpack set up is to leave out the devtool option, but Gatsby v2 is enabling it. I've tried coming up with a way based on the old version and the new docs, but it doesn't work:
// gatsby-node.js
exports.onCreateWebpackConfig = ({ actions, stage }) => {
if (stage === 'build-javascript') {
// turn off source-maps
actions.setWebpackConfig({
devtool: false
})
}
};
The code in the question is the correct solution. The problem was that Gatsby does not delete the /public/
folder on each build so previously created source maps were still there. So, first delete that folder, then run the build step.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With