Last active
March 13, 2019 07:06
-
-
Save tibotiber/34bfb533311f93d3b204ba4966f89bcc to your computer and use it in GitHub Desktop.
Medium: Deploy private source maps with Netlify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack') | |
function setSourceMaps (config, env) { | |
config.devtool = false | |
if (!config.plugins) { | |
config.plugins = [] | |
} | |
config.plugins.push( | |
new webpack.SourceMapDevToolPlugin({ | |
append: | |
env === 'development' | |
? '\n//# sourceMappingURL=[url]' | |
: '\n//# sourceMappingURL=https://storage.cloud.google.com/<bucket-name>/[url]', | |
filename: '[file].map' | |
}) | |
) | |
return config | |
} | |
module.exports = { | |
webpack: (config, env) => { | |
config = setSourceMaps(config, env) | |
return config | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment