Skip to content

Dcatfly/rename-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rename-webpack-plugin

Webpack plugin for rename output files. Because webpack is named using hash mode, you can not specify only part of the file.

Install

npm install --save-dev rename-webpack-plugin
yarn add --dev rename-webpack-plugin

Usage

const RenameWebpackPlugin = require('rename-webpack-plugin')

module.exports = {
  entry: 'app.js',
  output: {
    path: __dirname + '/dist',
    filename: 'app.[chunkhash].js'
  },
  plugins: [
    new RenameWebpackPlugin({
        originNameReg: /(.*)thirdpart\..*\.js/,
        targetName: '$1thirdpart.js'
    })
  ]
}

Options

Name Type Default Description
originNameReg {RegExp} This regexp is to filter out the name of the webpack output file you want to replace
targetName {String} This string is the name you want, because the plug-in uses the string replace method, so the string can use the grouping like $1

About

Webpack plugin for rename files.

Resources

License

Stars

Watchers

Forks

Packages

No packages published