Webpack-rename-plugin is a plugin for webpack to rename the file which you want it diffrent from the output.filename.
npm i -D webpack-rename-plugin
// webpack.config.js
const WebpackRenamePlugin = require('webpack-rename-plugin')
module.exports={
//...
plugins:[
new WebpackRenamePlugin({
origin: /background/, // regexp
outputName: '[name].js' //string
})
//or
new WebpackRenamePlugin([
{
origin: /your\/path/, // regexp
outputName: '[name].js' //string
},
{
origin: /your\/other\/path/, // regexp
outputName: '[name].js' //string
},
])
]
}