copy-rename-webpack-plugin
v1.0.2-alpha.0
Published
copy one file to multiple directories and rename it
Downloads
225
Readme
copy-rename-webpack-plugin
Copy one file to multiple directories and rename it.
Support for webpack4 and webpack5.
.
|____dist
| |____main.js
=>
.
|____dist
| |____main.js
|____build
| |____prod
| | |____main-prod.js
| |____pre
| | |____main-pre.js
usage
yarn add -D copy-rename-webpack-plugin
webpack.config.js
const path = require("path");
const CopyRenameWebpackPlugin = require("copy-rename-webpack-plugin");
module.exports = {
...
output: {
filename: "main.js",
},
plugins: [
new CopyRenameWebpackPlugin({
entry: "main.js",
output: [
"../build/pre/main-pre.js",
"../build/prod/main-prod.js",
],
}),
],
};
options
entry
entry need to match one of webpack output's filename.
such as: "main.js"
output
output must be an array which item is a file string with path.
such as: "../build/pre/main-pre.js"