Cannot use [chunkhash] for chunk in ‘[name].[chunkhash].js’ (use [hash] instead)

To solve this issue, add file­name prop­erty to your com­mon­sChunkPlu­gin config.

For exam­ple, make your com­mon­sChunkPlu­gin look like the following :

var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');

module.exports = function () {

    ...

    plugins: [
        new CommonsChunkPlugin({
            name: 'commons',
            filename: 'commons-[hash].js',
            chunks: ['vendor', 'app']
        }),

        ...

    ]

    ...

};

name: — Name of the chunk, so you can refer it to the other place if you want
filename: — Name of the cre­ated chunk, which will be added to the html files via script tag
chunks: — Extra



You may also like...