Angular-cli: Building with generated library gives 'ERROR in Maximum call stack size exceeded'

Created on 8 May 2018  Â·  4Comments  Â·  Source: angular/angular-cli

Versions


Angular CLI: 6.0.0
Node: 10.0.0
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.0
@angular-devkit/build-angular      0.6.0
@angular-devkit/build-ng-packagr   0.6.0
@angular-devkit/build-optimizer    0.6.0
@angular-devkit/core               0.6.0
@angular-devkit/schematics         0.6.0
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.0
@schematics/angular                0.6.0
@schematics/update                 0.6.0
ng-packagr                         3.0.0-rc.3
rxjs                               6.1.0
typescript                         2.7.2
webpack                            4.6.0

Repro steps

https://github.com/FMurray/repro
npm build --prod apttus
npm build --prod

Observed behavior

$ ng build --prod

Date: 2018-05-08T19:06:23.757Z
Hash: f31254860218ee068710
Time: 1628ms
chunk {main} main.44937c5acab68692e62e.js (main) 584 bytes [initial] [rendered]
chunk {polyfills} polyfills.32a0d02299c287d0205c.js (polyfills) 634 bytes [initial] [rendered]
chunk {runtime} runtime.992f46d7ae7a5557bff7.js (runtime) 5.38 kB [entry] [rendered]
chunk {styles} styles.21d2339248d4598cafe1.js (styles) 15.6 kB [initial] [rendered]

ERROR in Maximum call stack size exceeded
^^^^ this is the output if extractCss, aot and build optimizer are set to true

$ ng build --prod

Date: 2018-05-08T19:06:50.673Z
Hash: 6680e82cb941fc0de056
Time: 1521ms
chunk {main} main.44937c5acab68692e62e.js (main) 584 bytes [initial] [rendered]
chunk {polyfills} polyfills.32a0d02299c287d0205c.js (polyfills) 634 bytes [initial] [rendered]
chunk {runtime} runtime.992f46d7ae7a5557bff7.js (runtime) 5.38 kB [entry] [rendered]
chunk {styles} styles.21d2339248d4598cafe1.js (styles) 15.6 kB [initial] [rendered]

ERROR in No NgModule metadata found for 'AppModule'.
^^^^ this is the output if extractCss, aot and build optimizer are set to false


$ ng serve --port 4222
** Angular Live Development Server is listening on localhost: 4222, open your browser on http://localhost:4222/ **

Date: 2018-05-08T19:08:52.660Z
Hash: f68b4fdd6ffed9a6a900
Time: 1950ms
chunk {main} main.js, main.js.map (main) 1.91 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 672 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.4 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]

ERROR in No NgModule metadata found for 'AppModule'.
ℹ 「wdm」: Failed to compile.
ℹ 「wdm」: Compiling...

Date: 2018-05-08T19:09:03.968Z - Hash: 16397c493f1d8edfef4c - Time: 5997ms
1 unchanged chunks
chunk {main} main.js, main.js.map (main) 238 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 227 kB [initial] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 15.6 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 5.65 MB [initial] [rendered]
ℹ 「wdm」: Compiled successfully.
^^^^^ If I use ng serve, I will initially get the No NgModule found error and then if I make a trivial change in my AppModule file, it compiles but then throws the below error in the browser: 

Uncaught ReferenceError: process is not defined
    at Object../node_modules/process-nextick-args/index.js (index.js:3)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/readable-stream/lib/_stream_readable.js (_stream_readable.js:26)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/readable-stream/readable-browser.js (readable-browser.js:1)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/jsforce/lib/browser/request.js (request.js:3)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/jsforce/lib/transport.js (transport.js:10)
    at __webpack_require__ (bootstrap:81)

devkibuild-angular low inconvenient triage #1 bufix

Most helpful comment

had the same issue, wouldn't have found it without this comment: https://github.com/psykolm22/angular-google-place/issues/29#issuecomment-360884843 - i had to export my services in the public_api from the same barrel that they get imported from in the library itself.

All 4 comments

had the same issue, wouldn't have found it without this comment: https://github.com/psykolm22/angular-google-place/issues/29#issuecomment-360884843 - i had to export my services in the public_api from the same barrel that they get imported from in the library itself.

@anpross Dude, you are a LIFE SAVER! I wish I could like your comment more than once.

I am not sure this bug is "low"/"inconvenient". I wasted a LOT of time on this due to the VERY unhelpful error message and stack trace. :/

There have been numerous changes and improvements to the build pipeline since 6.0.0. The current version of the Angular CLI is 9.1.7. If anyone is still encountering this issue with the latest version, please consider opening a new issue detailing the problem.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

delasteve picture delasteve  Â·  3Comments

purushottamjha picture purushottamjha  Â·  3Comments

hareeshav picture hareeshav  Â·  3Comments

gotschmarcel picture gotschmarcel  Â·  3Comments

rajjejosefsson picture rajjejosefsson  Â·  3Comments