@tanem/remove-source-map-url-webpack-plugin
v1.0.13
Published
A webpack plugin that removes source map URLs.
Downloads
15
Maintainers
Readme
remove-source-map-url-webpack-plugin
A webpack plugin that removes source map URLs.
The problem
You want to send bundled files plus their external source maps to third-party monitoring services, but don't want to expose source maps to browser development tools.
This solution
This webpack plugin removes source map URLs from files in the output path when the build is done
.
💡Using
devtool: 'hidden-source-map'
is a simpler way of achieving the same result. Try that before reaching for this plugin!
Basic Usage
const RemoveSourceMapUrlWebpackPlugin = require('@tanem/remove-source-map-url-webpack-plugin')
const path = require('path')
module.exports = {
mode: 'development',
entry: './foo.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'foo.bundle.js'
},
plugins: [new RemoveSourceMapUrlWebpackPlugin()]
}
API
Arguments
options
- Optional An object containing the optional arguments defined below. Defaults to{}
.fileNameRegex
- Optional The regex used to filter files found within the output path. Defaults to/\.(js|css)$/
.
Example
const RemoveSourceMapUrlWebpackPlugin = require('@tanem/remove-source-map-url-webpack-plugin')
const path = require('path')
module.exports = {
mode: 'development',
entry: './foo.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'foo.bundle.js'
},
plugins: [new RemoveSourceMapUrlWebpackPlugin({ fileNameRegex: /\.js$/ })]
}
Installation
⚠️This library requires Node.js 8 or greater.
$ npm install @tanem/remove-source-map-url-webpack-plugin --save-dev
License
MIT