Skip to content

v9 migration for updating project tsconfig creates invalid file references #16035

@devversion

Description

@devversion

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.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions