angular-cli: Webpack rebuild error

OS?

Ubuntu 16.04

Versions

angular-cli: 1.0.0-beta.28.3 node: 7.4.0 os: linux x64 @angular/common: 2.4.5 @angular/compiler: 2.4.5 @angular/core: 2.4.5 @angular/forms: 2.4.5 @angular/http: 2.4.5 @angular/platform-browser: 2.4.5 @angular/platform-browser-dynamic: 2.4.5 @angular/router: 3.4.5 @angular/compiler-cli: 2.4.5

Repro steps.

Created the app with the angular-cli (ng new). Ran ng serve to make sure everything was working. All was good, webpack worked and reported:

Hash: 7a95e8c73d53b9f210c7                    
Time: 8041ms
chunk    {0} main.bundle.js, main.bundle.map (main) 17.2 kB {3} [initial] [rendered]
chunk    {1} styles.bundle.js, styles.bundle.map (styles) 205 kB {4} [initial] [rendered]
chunk    {2} scripts.bundle.js, scripts.bundle.map (scripts) 375 kB {4} [initial] [rendered]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.83 MB [initial] [rendered]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
webpack: Compiled successfully.

I was able to load the app in a browser. Made a small change to the app.component.ts file (removed the trailing new line). Saved the file, webpack attempted to re-bundle the file, but failed.

The log given by the failure.

Hash: 7a95e8c73d53b9f210c7                
Time: 613ms
chunk    {0} main.bundle.js, main.bundle.map (main) 17.2 kB {3} [initial]
chunk    {1} styles.bundle.js, styles.bundle.map (styles) 205 kB {4} [initial]
chunk    {2} scripts.bundle.js, scripts.bundle.map (scripts) 375 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 2.83 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry]

ERROR in Cannot read property 'length' of undefined
webpack: Failed to compile.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 21 (2 by maintainers)

Commits related to this issue

Most upvoted comments

npm install --save @ngtools/webpack@1.2.4 

That’s it! Works also with the new version (.28).

ok I reverted back to .26 so I can work for now but that was not enough. I also had to:


npm install --save @ngtools/webpack@1.2.4

until .28 gets stable

I agree, I started crying from joy of how fast it was… but started crying again when it crashed

I know this topic is closed, but when we search on Google this is the first result and I hope it helps whoever comes to this page and see the last comment.

this works for me

yarn add @ngtools/webpack@1.3.0

ng details: @angular/cli: 1.0.0 node: 7.9.0 os: darwin x64

@angular/common: 4.0.2
@angular/compiler: 4.0.2
@angular/core: 4.0.2
@angular/forms: 4.0.2
@angular/http: 4.0.2
@angular/platform-browser: 4.0.2
@angular/platform-browser-dynamic: 4.0.2
@angular/router: 4.0.2
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.2
@ngtools/webpack: 1.3.0

Same here on ubuntu 16.10 and node 6.9.2.

Happens with ng-cli 1.0.0-beta.22-1 1.0.0-beta.24 1.0.0-beta.26 1.0.0-beta.28

hocam su adresde https://github.com/angular/angular-cli/issues/4326 da birkaç kişi sorun yaşamış yarn add @ngtools/webpack@1.3.0 ile biri sorunu çözmüş şimdiki güncel i yarn add @ngtools/webpack@1.8.2 bir denermisiniz

I may be wrong, but I believe it may have to do with the fact that the typescript doesn’t get compiled, or at least compiled correctly after the first initial build. See my other comment