TL;DR
What config options do I need to set in the SourceMapDevToolPlugin to emulate devtool: 'source-map'?
I have to use SourceMapDevToolPlugin to avoid generating a source map for my vendor modules....but I want source-map style maps, not inline-source-map.
Details:
I'm using webpack 4, and don't want to waste time generating a vendor.js.map, so I can't just set devtool and I instead do this:
https://webpack.js.org/plugins/source-map-dev-tool-plugin/#exclude-vendor-maps
but I notice this comment:
You can use the following code to replace the configuration option devtool: inline-source-map with an equivalent custom plugin configuration:
I, for the life of me, can't figure out what options I need to pass in to the plugin to replicate devtool: 'source-map', instead of inline-source-map
my package.json:
"scripts": {
"build": "webpack -p --config webpack.prod.js",
"start": "webpack-dev-server --debug --bail --config webpack.dev.js"
},
my (relavent) webpack config:
module.exports = {
devtool: false, // using SourceMapDevToolPlugin instead
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all'
},
styles: {
test: /\.css$/,
name: 'styles',
chunks: 'all'
}
}
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: '[name].map',
exclude: ['vendor.js']
})
]
}
and my dev config:
module.exports = merge(common, {
mode: 'development',
devServer: {
contentBase: './public',
stats: 'minimal'
}
});
and my prod config
module.exports = merge(common, {
mode: 'production',
stats: 'errors-only'
});