Skip to content

Instantly share code, notes, and snippets.

@tibotiber
Last active March 13, 2019 07:06
Show Gist options
  • Save tibotiber/34bfb533311f93d3b204ba4966f89bcc to your computer and use it in GitHub Desktop.
Save tibotiber/34bfb533311f93d3b204ba4966f89bcc to your computer and use it in GitHub Desktop.
Medium: Deploy private source maps with Netlify
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