lean / phaser-es6-webpack

A bootstrap project for create games with Phaser + ES6 + Webpack.
MIT License
1.28k stars 319 forks source link

Explicit `chunks` line may break webpack by omitting other dependencies #58

Closed mrisher closed 6 years ago

mrisher commented 6 years ago

My webpack.prod.conf.js is from a newer template than yours; in my version, webpack attempts to split the webpack runtime into a manifest.js file. When I blindly copied your explicit chunks statement into my template, it caused the generated index.html to exclude this manifest, which resulted in webpack not getting loaded (you get a runtime JS error like "webpackjsonp is not defined"

The solution is to explicitly mention manifest in the chunks block.

Here's the code from my vue-cli template:

    // extract webpack runtime and module manifest to its own file in order to
    // prevent vendor hash from being updated whenever app bundle is updated
    new webpack.optimize.CommonsChunkPlugin({
      name: 'manifest',
      minChunks: Infinity
    }),

I'd recommend changing the line

chunks: ['vendor', 'app']

to

chunks: ['manifest', 'vendor', 'app']

in this file https://github.com/lean/phaser-es6-webpack/blob/28b3021e52bcbd0ce425b9ce593a94bde06aef2a/webpack.config.js#L38

lean commented 6 years ago

@mrisher please, could you show your webpack configuration?