angular: [Angular 9.0.4] Building throws `ERROR in Error when flattening the source-map "[...].d.ts.map" for "[...].d.ts": Maximum call stack size exceeded`
š bug report
Affected Package
Probably @angular/cli
, but I was asked to open the issue here.
Is this a regression?
Yes. The issue does not occur with Angular 9.0.2. Version 9.0.3 causes a different RangeError: Maximum call stack size exceeded
error, tracked here: https://github.com/angular/angular-cli/issues/17106.
Description
Building and serving both fail consistently with a bunch of the following messages:
ERROR in Error when flattening the source-map "[/path/to/file1].d.ts.map" for "[/path/to/file1].d.ts": RangeError: Maximum call stack size exceeded
ERROR in Error when flattening the source-map "[/path/to/file2].d.ts.map" for "[/path/to/file2].d.ts": RangeError: Maximum call stack size exceeded
...
ERROR in Error when flattening the source-map "[/path/to/fileN].d.ts.map" for "[/path/to/fileN].d.ts": RangeError: Maximum call stack size exceeded
The issue seems similar to the above mentioned one and deleting node_modules
does not fix it.
My setup is an Angular workspace with two projects: an app and a lib. The source-maps being āflattenedā when the error occurs belong to the lib. The error occurs when attempting to build (--prod
or otherwise) or serve the app.
š Your Environment
Angular Version:
Angular CLI: 9.0.4
Node: 13.9.0
OS: linux x64
Angular: 9.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.900.4
@angular-devkit/build-angular 0.900.4
@angular-devkit/build-ng-packagr 0.900.4
@angular-devkit/build-optimizer 0.900.4
@angular-devkit/build-webpack 0.900.4
@angular-devkit/core 9.0.4
@angular-devkit/schematics 9.0.4
@angular/cdk 9.1.0
@ngtools/webpack 9.0.4
@schematics/angular 9.0.4
@schematics/update 0.900.4
ng-packagr 9.0.2
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 13
- Comments: 35 (7 by maintainers)
Commits related to this issue
- fix(ngcc): don't crash on cyclic source-map references The source-map flattening was throwing an error when there is a cyclic dependency between source files and source-maps. The error was either a c... — committed to petebacondarwin/angular by petebacondarwin 4 years ago
- fix(ngcc): don't crash on cyclic source-map references The source-map flattening was throwing an error when there is a cyclic dependency between source files and source-maps. The error was either a c... — committed to petebacondarwin/angular by petebacondarwin 4 years ago
- fix(ngcc): don't crash on cyclic source-map references (#36452) The source-map flattening was throwing an error when there is a cyclic dependency between source files and source-maps. The error was e... — committed to angular/angular by petebacondarwin 4 years ago
- fix(ngcc): don't crash on cyclic source-map references (#36452) The source-map flattening was throwing an error when there is a cyclic dependency between source files and source-maps. The error was e... — committed to angular/angular by petebacondarwin 4 years ago
I was getting this after an upgrade from 9.0.2 -> 9.0.4. Deleting
node_modules
didnāt fix it, but deleting bothnode_modules
anddist
folders thennpm ci
and rebuild/re-serve did the trick.Iāve got a slightly odd layout, a framework workspace and a separate application workspace that uses
tsconfig.json
paths to reference the framework packages out of their built dist folders.with angular 9, there is a incremental build process which is in the /dist folder.
I had the same problem. I removed my
dist
andpackage-lock.json
and then rannpm install
and all seems to be well now.I donāt understand, I donāt have the error anymore on my local computer (windows), but on my gitlab ci job (docker and linux), I am getting this:
ERROR in Error when flattening the source-map ā/builds/applications/frontsxxxx/node_modules/ngx-window-token/ngx-window-token.d.ts.mapā for ā/builds/applications/fronts/xxxx/node_modules/ngx-window-token/ngx-window-token.d.tsā: RangeError: Maximum call stack size exceeded
EDIT: Ok I have found out. I had to delete all the cache created by gitlab runner to have this working !
I could reproduce what I reported consistently even after removing
node_modules
. However, after removing mydist
folder (generated when building the lib), I can no longer reproduce the issue, even across rebuilds.This is odd because I believe that Angular shouldnāt even be looking at that folder, but that might be a different issue.
Iāll close this for now since I can no longer reproduce the issue, but feel free to reopen it if others can reproduce it more consistently. Iāll also open a new issue describing what I mean by āAngular shouldnāt be looking at that folderā (which Iāve now realised is causing an annoying error).
Having the same issue updating today. Removing the dist folder fixed the problem. Now I ājustā have to tell everyone who will get the update commit š
My build just failed in Azure DevOps, just as @mattiaskagstrom stated. Going to have to rollback this changeset. It built fine locally.
Weāre using docker, both locally and in the cloud.
@adamdport š personally none of that worked for me, what fixed it was updating terser library to latest, but it doesnāt have to work for you, so my guide is: grab the code and slam it against the wall a couple of times, what sticks, fix it :p