question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

  1. yarn install
  2. 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:closed
  • Created 4 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
alan-agius4commented, Jan 27, 2020

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.

1reaction
rhalffcommented, Feb 9, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular library versioning: should I trust the docs or the CLI?
The CLI doesn't "trust" future major versions of Angular because there may be breaking changes that will prevent your library from working.
Read more >
What's new features in Angular 10? - Morioh
Angular 10 is likely to be smaller than previous versions of Angular. ... handle libraries generated with CLI versions past v6.2.0 (#35824) (59607dc), ......
Read more >
Creating libraries - Angular
This page provides a conceptual overview of how to create and publish new libraries to extend Angular functionality. If you find that you...
Read more >
sebasg - npm
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.2.0. sebasg22. published 0.0.2 • 3 years ago ...
Read more >
Building an Angular Library with multiple entry points | Articles
The Angular CLI has a generate library command to generate a new Angular ... Then it's time to split the library into multiple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found