NPM run build change name file

Viewed 3386

How to rename a file when I use the npm run build command. I want to generate a file with bundle.js name instead of 2.31b4fde6.chunk.js

1 Answers

Use following syntax in webpack.config.js

module.exports = {
    entry: './index.js',
    output: {
        filename: 'main.js',
        path: path.resolve(__dirname, 'dist')
    },
}

It will create main.js under dist folder.

Related