Maximum call stack size exceeded after updating `@angular/compiler-cli`
π Bug report
Command (mark with an x)
- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, the previous version in which this bug was not present was: 9.0.2Description
After updating `@angular/compiler-cli 9.0.3` during ng serve I receive following error: `ERROR in Maximum call stack size exceeded`π¬ Minimal Reproduction
π₯ Exception or Error
ERROR in Maximum call stack size exceeded
π Your Environment
ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.0.3
Node: 12.13.1
OS: linux x64
Angular: 9.0.3
... animations, cli, common, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.3
@angular-devkit/build-angular 0.900.3
@angular-devkit/build-optimizer 0.900.3
@angular-devkit/build-webpack 0.900.3
@angular-devkit/core 9.0.3
@angular-devkit/schematics 9.0.3
@angular/cdk 9.1.0
@angular/compiler 9.0.2
@angular/material 9.1.0
@ngtools/webpack 9.0.3
@schematics/angular 9.0.3
@schematics/update 0.900.3
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
Anything else relevant?
I've just created a new site from scratch on angular 9, and got this error, installed terser@latest, error gone, so it is confirmed on my side that the terser library required by server-platform is the buggy element.
I got this error as soon as I created a pipe in my project. The app is using angular 9.0.4. When I removed implement PipeTransform from the pipe, the error disappeared but now lint is complaining i should implement the interface. But luckily I no longer need the pipe, so I will delete it and no prob. I was also using domSanitizer in the tranform method.
I had to reorganize some of my index.ts which were exposed in public-api.ts of my lib.
I had this error as well but in slightly different circumstances:
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ β³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 9.1.0
Node: 10.19.0
OS: win32 x64
Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.901.0
@angular-devkit/build-angular 0.901.0
@angular-devkit/build-ng-packagr 0.901.0
@angular-devkit/build-optimizer 0.901.0
@angular-devkit/build-webpack 0.901.0
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@ngtools/webpack 9.1.0
@schematics/angular 9.1.0
@schematics/update 0.901.0
ng-packagr 9.0.0
rxjs 6.5.5
typescript 3.7.5
webpack 4.39.2
I was trying to build a prod library, this has to have ivy turned off. A library build with Ivy was fine. I tried all the various fixes listed here but nothing helped.
In the end I discovered that barrel files broke it for me.
This code worked fine:
// public-api.ts
export * from './my-module.module';
export * from './constants/constants';
(constants just exports 2 strings)
This code fails:
// public-api.ts
export * from './my-module.module';
export * from './constants';
(exports an index.ts file that just exports * from constants)
The workaround I found was to directly export every file in public.api and avoid barrels. The npm lib barrelsby helped a lot with this:
barrelsby -e .spec.ts -D true -l top -n public.api
The possible reasons for the issues are
- Infinite recursion: recursive function call without a termination condition
- Importing Parent Module in childe module
- Mistakenly Self importing a module (see example)
@NgModule({
imports: [
TestModule
],
declarations: [],
exports: []
})
export class TestModule { }
The answer of @kalimulhaq helps me, in my case, I was exporting my own module :/
declarations: [
MyComponent
],
imports: [
CommonModule
],
exports: [
MyModule, <---- My problem
]
})
export class MyModule { }
Another possible reason is something like this:
export function max(values) {
return max(_.compact(values)); // Calling itself instead of _.max
}
Seta no angular.json "aot": false,
Seta no angular.json "aot": false,
Funcionou para mim. Obrigado!
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.