• 0

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

To solve this issue, add filename property to your commonsChunkPlugin config. For example, make your commonsChunkPlugin 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 created chunk, which will be added to the html files via script tag chunks: - Extra