Rename Output Webpack Plugin
Webpack plugin to custom rename each outfile files / chunks generated during build.
Installation | Usage | License
Installation
npm install rename-output-webpack-plugin --save-dev
Usage
// webpack.config.js const renameOutputPlugin = ; moduleexports = entry: 'core': './src/core.js' 'app': './src/index.js' 'jquery': 'jquery' 'angular-suite': 'angular' 'angular-ui-bootstrap' 'angular-ui-router' output: 'filename': '[name]-[id].js' 'path': path plugins: 'core': 'framework-[hash].js' 'jquery': '[name]-[version].min.js' 'angular-suite': '[name]-[version@angular].min.js' ;
This configuration will generate following files:
Hash: 7aa4bcb22d7fa4791dd8Version: webpack 3.8.1Time: 1812ms Asset Size Chunks Chunk Names app-0.js 2.08 MB 0 [emitted] [big] app angular-suite-1.6.6.min.js 1.73 MB 1 [emitted] [big] angular-suite jquery-3.2.1.min.js 271 kB 2 [emitted] [big] jqueryframework-7aa4bcb22d7fa4791dd8.js 271 kB 3 [emitted] [big] core
Using [version]
In Webpack configuration (webpack.config.js), output.filename supports following substitutions:
- [hash]
- [chunkhash]
- [name]
- [id]
- [query]
This plugin adds one more substitution [version]
. [version]
allow you to use version of dependency within your output bundle filename. For e.g. If you are using jquery and chunking it separately, you can add [version]
to ensure right version (from jquery module package.json) is added within output filename.
moduleexports = entry: 'jquery': 'jquery' ... plugins: 'jquery': '[name]-[version].min.js' ;
Asset Size Chunks Chunk Namesjquery-3.2.1.min.js 271 kB 2 [emitted] [big] jquery
License
This project is licensed under the MIT License - see the LICENSE file for details