Issue
In Angular (see spec below), trying to generate a large library, thus running ng build <project>
, we obtain
❌ Generating "fesm2015"
Invalid string length
Indeed, fesm2020 build succeeded.
The dist sourcemap for fesm2020 reached 32MB, while the fesm2015 sourcemap reached 33MB (.mjs.map file).
The entire source code is about 200 components distributed in 1 single library.
Reproduction
- Create 200+ components and include them in a single library module
- run
ng build <project>
Error
Invalid string length
after Generating fesm2015
Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 14.2.6
Node: 18.15.0 (Unsupported)
Package Manager: npm 9.5.0
OS: win32 x64
Angular: 14.2.6
... animations, cli, common, compiler, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1402.6
@angular-devkit/build-angular 14.2.6
@angular-devkit/core 14.2.6
@angular-devkit/schematics 14.2.6
@angular/compiler-cli 14.3.0
@schematics/angular 14.2.6
ng-packagr 14.0.1
rxjs 6.5.4
typescript 4.7.3
Is the any suggestion that we can adopt, even something to get a clearer view of what's happening (no verbose error is printed). We'd like to avoid splitting the code into different libraries even if it seems to be a problem of source code size/length.
Solution
The solution appeared to be upgrading to Angular 16+, while splitting large codes into different library entry points.
This should no longer be a problem with version 16+.
Answered By - Vincenzo Manto
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.