joeeames / WebpackFundamentalsCourse

272 stars 122 forks source link

Problem with running example from chapter: "Creating Multiple Bundles" with webpack 2 Probably with var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('shared.js'); #14

Closed MarkoKacprzak closed 7 years ago

MarkoKacprzak commented 7 years ago

In Windows OS after fixing last line in config (extensions: ['.js', '.es6']) - removing empty string for wepack 2.0: running webpack-dev-server received: Project is running at http://localhost:8080/ webpack output is served from /public/assets/js/ Content not from webpack is served from public C:\Users\xyz\AppData\Roaming\npm\node_modules\webpack\lib\Chunk.js:45 throw new Error("Chunk.entry was removed. Use hasRuntime()"); Error: Chunk.entry was removed. Use hasRuntime() at Chunk.set entry [as entry] (C:\Users\xyz\AppData\Roaming\npm\node_modules\webpack\lib\Chunk.js:45:9)


I've found that fixing that problem is using webpack-dev-server specyfic to old version so please run first:

1.: npm install webpack-dev-server@1.12.1 --save-dev modify extensions to contain empty string

but still i want to run with webpack 2.

MarkoKacprzak commented 7 years ago

I've found fix for this problem for "webpack": "^2.4.1", "webpack-dev-server": "^2.4.2" in webconfig.config.js

First: //var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('shared.js'); var commonsPlugin = new webpack.optimize.CommonsChunkPlugin({ name: ['shared'] }); Last: // resolve: { extensions: ['', '.js', '.es6'] } resolve: { extensions: ['.js', '.es6'] }