angular-cli: Core module changes break compilation

OS?

macOS Sierra (10.12.3)

Versions.

angular-cli: 1.0.0-beta.28.3 node: 6.9.2 os: darwin 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.

Our app was created using the angular-cli and has a core module, as documented here. The app compiles successfully when running ng serve. Changes to any files outside of the core module cause the app to recompile, which completes successfully. However, changes to any files inside the core module cause recompilation, which fails with the error below. All subsequent changes that trigger recompilation will then also fail.

I am currently trying to reproduce this in a basic new project. I will link here if successful.

The log given by the failure.

ERROR in ./src/app/core/auth.service.ts
Module build failed: RangeError: Maximum call stack size exceeded
    at Array.filter (native)
    at _diagnoseDeps (/Users/sam/Developer/ng-project/node_modules/@ngtools/webpack/src/loader.js:261:10)
    at /Users/sam/Developer/ng-project/node_modules/@ngtools/webpack/src/loader.js:264:9
    at Array.forEach (native)
    at _diagnoseDeps (/Users/sam/Developer/ng-project/node_modules/@ngtools/webpack/src/loader.js:262:10)
    at /Users/sam/Developer/ng-project/node_modules/@ngtools/webpack/src/loader.js:264:9
    at Array.forEach (native)
    at _diagnoseDeps (/Users/sam/Developer/ng-project/node_modules/@ngtools/webpack/src/loader.js:262:10)
    at /Users/sam/Developer/ng-project/node_modules/@ngtools/webpack/src/loader.js:264:9
    at Array.forEach (native)
***repeated a few hundred times, removed for brevity***
 @ ./src/app/app.component.ts 13:0-50
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

Mention any other details that might be useful.

We believe this issue has been introduced by angular-cli v1.0.0-beta.28.3, since it works with v1.0.0-beta.26.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

We see this issue happening with the @ngtools/webpack version 1.2.5 that dropped. We ended up doing an

npm i -D @ngtools/webpack@1.2.4

to force the version back for the time being so we can get our stuff working until this is figured out.

@ngtools/webpack@1.2.7 solved it for us. Thank you!

It is happening to me when is recompiling 😕

Thanks for the heads up @clydin.

Currently struggling to see where the circular dependency is being introduced. The auth service only injects a couple of dependencies (see below), none of which reference the auth service.

constructor(
    private authHttp: AuthHttp,
    private zone: NgZone,
    private router: Router
  ) { }

Any ideas?

The underlying cause is a circular dependency involving the file (auth.service.ts) mention in the error.

There were some changes in diagnostics reporting that make it sensitive to circular dependencies.