undecorated-classes-with-di: libraries generated with CLI versions older than v6.2.0 break
See original GitHub issue🐞 Bug report
Command (mark with an x
)
- update
Is this a regression?
unknown
Description
When using ng update @angular/core --force --migrate-only --from=8
, I received the following error:
TypeScript project "lib/tsconfig.lib.json" has configuration errors. This could cause an incomplete migration. Please fix the following failures and rerun the migration:
error TS100: Angular compiler option "flatModuleIndex" requires one and only one .ts file in the "files" field.
I tracked the error down to the inclusion of
"angularCompilerOptions": {
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
}
In one of my library’s tsconfig.lib.json
files. I tried deleting both
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
And the migration completes successfully.
I believe both "flatModuleId"
and "flatModuleOutFile"
were added by a previous version of the angular CLI (version 7?) when I generated this library (via ng g library
). If these compiler options are no longer needed by the current CLI, I would expect the migration to remove them without error.
The error was made more confusing because the error message references an angular configuration option that is not actually present in my tsConfig file: "flatModuleIndex"
.
🔬 Minimal Reproduction
A reproduction repo can be found here: https://gitlab.com/service-work/is-loading/tree/angular-update-issue
From the repo root, run
yarn install
yarn ng update @angular/core --force --migrate-only --from=8
🔥 Exception or Error
TypeScript project "lib/tsconfig.lib.json" has configuration errors. This could cause an incomplete migration. Please fix the following failures and rerun the migration:
error TS100: Angular compiler option "flatModuleIndex" requires one and only one .ts file in the "files" field.
🌍 Your Environment
Angular CLI: 9.0.0-rc.10
Node: 10.16.0
OS: darwin x64
Angular: 9.0.0-rc.11
... common, compiler, compiler-cli, core, language-service
... platform-browser, platform-browser-dynamic
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.900.0-rc.10
@angular-devkit/build-angular 0.900.0-rc.10
@angular-devkit/build-ng-packagr 0.900.0-rc.10
@angular-devkit/build-optimizer 0.900.0-rc.10
@angular-devkit/build-webpack 0.900.0-rc.10
@angular-devkit/core 9.0.0-rc.10
@angular-devkit/schematics 9.0.0-rc.10
@angular/cli 9.0.0-rc.10
@ngtools/webpack 9.0.0-rc.10
@schematics/angular 9.0.0-rc.10
@schematics/update 0.900.0-rc.10
ng-packagr 9.0.0-rc.7
rxjs 6.5.4
typescript 3.6.5
webpack 4.41.2
Anything else relevant?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (6 by maintainers)
The main reason behind that Ivy is desired during development is to have a better development experience since when using VE rebuild times will be slower because the library will be to be converted to Ivy compatible code on every change with NGCC.
For production builds (Libraries that will be shipped to NPM), using Ivy is not desired because Ivy libraries are not backward compatible with VE. Also the internal Ivy instruction set is not yet stable and might change in minor/patch version which might result in libraries compiled using Angular version 9.0.0 not to be compatible with Angular 9.0.1.
Had the same error and also removed the entries as suggested by @thefliik which seems to fix those errors. The particular migration where this occurs is:
migration-v9-undecorated-classes-with-di