Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
devversion opened this issue Nov 2, 2019 · 1 comment
Closed

Comments

@devversion
Copy link
Member

devversion commented Nov 2, 2019

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

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants