-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
The tsconfig app update migration for version 9 of the CLI creates invalid references inside tsconfig files. This causes the app compilation to break, and potentially breaks subsequent migrations as the TS project is no longer valid (e.g. the undecorated classes-with-di migration).
The migration currently naively assumes the main.ts files is always next to the tsconfig.
angular-cli/packages/schematics/angular/migrations/update-9/update-app-tsconfigs.ts
Lines 85 to 89 in e70a2b0
| const rootInSrc = tsConfigPath.includes('src/'); | |
| const rootSrc = rootInSrc ? '' : 'src/'; | |
| const files = builderName === Builders.Server | |
| ? [`${rootSrc}main.server.ts`] | |
| : [`${rootSrc}main.ts`, `${rootSrc}polyfills.ts`]; |
This is not very reliable as often the target is structured differently, or the main.ts file has a different name. This is totally valid since there is an builder option called main that can be set to an arbitrary file.
Ideally the migration would not try to guess the path to the main file, but rather rely on the builder options. An example of a scenario that currently breaks:
| packages/my-lib/tsconfig.json
| packages/my-lib/src/main.ts
In those cases, the current migration logic will insert ./main.ts into the tsconfig, while it should be actually ./src/main.ts. Same most likely applies to the polyfills.ts file. Ideally this would be resolved through the polyfills builder option.
cc. @filipesilva