https://github.com/rbarilani/remove-source-map-url-webpack-plugin
Remove source map url comments Webpack Plugin
https://github.com/rbarilani/remove-source-map-url-webpack-plugin
webpack
Last synced: 9 months ago
JSON representation
Remove source map url comments Webpack Plugin
- Host: GitHub
- URL: https://github.com/rbarilani/remove-source-map-url-webpack-plugin
- Owner: rbarilani
- License: mit
- Created: 2017-02-10T10:04:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T15:02:05.000Z (over 3 years ago)
- Last Synced: 2025-04-13T14:48:18.371Z (about 1 year ago)
- Topics: webpack
- Language: JavaScript
- Size: 658 KB
- Stars: 11
- Watchers: 1
- Forks: 4
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Remove Source Map Url Webpack Plugin
====================================


[](https://david-dm.org/rbarilani/remove-source-map-url-webpack-plugin)
[](https://david-dm.org/rbarilani/remove-source-map-url-webpack-plugin?type=dev)
[](https://travis-ci.com/rbarilani/remove-source-map-url-webpack-plugin)
[](https://coveralls.io/github/rbarilani/remove-source-map-url-webpack-plugin?branch=master)
This is a webpack plugin that removes `# sourceMappingURL` after compilation.
It's a quick fix for wrong `# sourceMappingURL` comments left in vendor source code when compiling without minification (causing 404 responses from the server).
## Install
You can install the plugin via npm or yarn, pick the right version **based on the webpack version** used in your project.
**Webpack 4**
For webpack 4 install the 0.x version
```bash
$ npm install @rbarilani/remove-source-map-url-webpack-plugin@0.x --save-dev
```
**Webpack 5**
For webpack 5 install the latest version
```bash
$ npm install @rbarilani/remove-source-map-url-webpack-plugin@latest --save-dev
```
## Usage
```js
var RemoveSourceMapUrlWebpackPlugin = require('@rbarilani/remove-source-map-url-webpack-plugin');
var webpackConfig = {
entry: 'index.js',
output: {
path: 'dist',
filename: 'index_bundle.js'
},
plugins: [
new RemoveSourceMapUrlWebpackPlugin({
test: /index_bundle\.js$/
})
]
};
```
## Options
* `test`: A condition that must be met to include or exclude the assets that should be processed (*default*: `/\.js($|\?)/i`). The allowed types for a condition are:
* `String` - A string for exact matching with the file name of the asset
* `RegExp` - A regular expression which will be tested against the file name of the asset
* `Function(fileName:string):bool` - A function that will be invoked with the file name of the asset as the argument and must return `true` to include the asset or `false` to exclude it
## Contributing
You're are welcome to contribute to this project by submitting issues and/or pull requests.
## Development
### NPM scripts
* `npm test` - run test suite
* `npm run test:coverage` - run test suite and generate coverage reports
* `npm run test:build` - build the test mock project with webpack-cli
* `npm run lint` - lint the code base with eslint
* `npm run lint:fix` - try to fix as many linting issues as possible (the command will also format the code)
* `npm run format` - format code following project conventions
* `npm run coveralls` - send coverage report to https://coveralls.io
## License
This project is licensed under [MIT](./LICENSE).