Webpack-dev-server: Webpack 3 CommonsChunkPlugin.js:289 Cannot read property 'Symbol(Symbol.iterator)' of undefined

Created on 19 Jun 2017  路  8Comments  路  Source: webpack/webpack-dev-server



Do you want to request a feature or report a bug?
Bug


What is the current behavior?
Running webpack dev server 2.4.5 with webpack 3 causes a TypeError.
76% basic chunk optimization/Users/.../node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:289
for(const module of chunk.modulesIterable) {
^
TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined

If the current behavior is a bug, please provide the steps to reproduce.
Run: webpack-dev-server

10% building modules 3/3 modules 0 activeProject is running at https://localhost:4200/
webpack output is served from /
404s will fallback to /index.html
76% basic chunk optimization/Users/.../node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:289
for(const module of chunk.modulesIterable) {
^

TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
at usedChunks.reduce (/Users/.../node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:289:29)
at Array.reduce (native)
at CommonsChunkPlugin.getExtractableModules (/Users/.../node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:288:46)
at targetChunks.forEach (/Users/.../node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:136:38)
at Array.forEach (native)
at Compilation.compilation.plugin (/Users/.../node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:102:18)
at Compilation.applyPluginsBailResult1 (/Users/.../node_modules/tapable/lib/Tapable.js:120:27)
at Compilation.seal (/Users/.../node_modules/webpack-dev-server/node_modules/webpack/lib/Compilation.js:571:9)
at /Users/.../node_modules/webpack-dev-server/node_modules/webpack/lib/Compiler.js:488:16
at /Users/.../node_modules/tapable/lib/Tapable.js:225:11
at _addModuleChain (/Users/.../node_modules/webpack-dev-server/node_modules/webpack/lib/Compilation.js:477:11)
at processModuleDependencies.err (/Users/.../node_modules/webpack-dev-server/node_modules/webpack/lib/Compilation.js:448:13)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
error Command failed with exit code 1.



What is the expected behavior?
Webpack 2.6.1 with webpack dev server 2.4.5 started fine without any issues.

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

Webpack: 3.0.0
webpack-dev-server: 2.4.5
Node.js: 8.1.1
Angular: 4.2.3
ts-node: 3.0.6


This issue was moved from webpack/webpack#5094 by @sokra. Orginal issue was by @noumaans.

Most helpful comment

Okay installing it with npm and not with yarn fixes the problem => "webpack-dev-server": "^2.6.1"

All 8 comments

I can confirm this with [email protected]

I had this same issue. I was referencing one package with a dependency on webpack 3 and as well as referening webpack version 2.6.1. The issue was resolved once the webpack reference to version 3.

any idea when it will be released? Thanks a lot!

I have this issue as well. with [email protected] and [email protected]
Webpack normal buddle works very well. Hope can fix it ASAP

is there a fix? webpack-dev-pack always throws the error above.

Okay installing it with npm and not with yarn fixes the problem => "webpack-dev-server": "^2.6.1"

Closing citing the solution by @marc101101

Have the same probs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mischkl picture mischkl  路  3Comments

hnqlvs picture hnqlvs  路  3Comments

Jack-Works picture Jack-Works  路  3Comments

antoinerousseau picture antoinerousseau  路  3Comments

MJ111 picture MJ111  路  3Comments