I'd like to hide a part of my code from being shown in chrome dev tools. Is it possible with webpack?
I guess you could create an identity loader who filters out sourcemaps for these particular files.
// remove-sourcemap.loader.js
module.exports = function(source, map) {
this.callback(null, source)
};
Then, in your webpack config:
module: {
loaders: [
include: [/* list of files (absolute path) for which to remove sourcemaps */],
loader: 'remove-sourcemap',
],
},
You could also manually apply the SourceMapDevToolPlugin
instead of using the devtool
configuration option. The plugin supports asset matching in the same way loaders do.
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