-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
fix(compiler-cli): support relative imports to symbols outside rootDir
#60555
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By default, the compiler-cli uses the relative import strategy when there is no `rootDir` or `rootDirs`. This is expected as everything is assumed to be somehow reachable through relative imports. With `rootDirs` that allow for a "virtual file system"-like environment, the compiler is not necessarily able to always construct proper relative imports. The compiler includes the `LogicalProjectStrategy` for this reason. This strategy is able to respect `rootDirs` to construct relative paths when possible. This logic currently accidentally triggers when there is a `rootDir` set. This option is not to be confused with the virtual directory option called `rootDirs`. The compiler currently confuses this and accidentally enters this mode when there is just a `rootDir`— breaking in monorepos that imports can point outside the `rootDir` to e.g. other compilation unit's `.d.ts` (which is valid; just not `.ts` sources can live outside the root dir). This is necessary for our Bazel toolchain migration.
alxhub
approved these changes
Mar 25, 2025
This comment was marked as outdated.
This comment was marked as outdated.
Caretaker note: PR is green; it just seems to be stuck with the mergeability status |
This PR was merged into the repository by commit 9f18c7c. The changes were merged into the following branches: main, 19.2.x |
alxhub
pushed a commit
that referenced
this pull request
Mar 27, 2025
…ir` (#60555) By default, the compiler-cli uses the relative import strategy when there is no `rootDir` or `rootDirs`. This is expected as everything is assumed to be somehow reachable through relative imports. With `rootDirs` that allow for a "virtual file system"-like environment, the compiler is not necessarily able to always construct proper relative imports. The compiler includes the `LogicalProjectStrategy` for this reason. This strategy is able to respect `rootDirs` to construct relative paths when possible. This logic currently accidentally triggers when there is a `rootDir` set. This option is not to be confused with the virtual directory option called `rootDirs`. The compiler currently confuses this and accidentally enters this mode when there is just a `rootDir`— breaking in monorepos that imports can point outside the `rootDir` to e.g. other compilation unit's `.d.ts` (which is valid; just not `.ts` sources can live outside the root dir). This is necessary for our Bazel toolchain migration. PR Close #60555
mattrberry
pushed a commit
to mattrberry/angular
that referenced
this pull request
Mar 28, 2025
…ir` (angular#60555) By default, the compiler-cli uses the relative import strategy when there is no `rootDir` or `rootDirs`. This is expected as everything is assumed to be somehow reachable through relative imports. With `rootDirs` that allow for a "virtual file system"-like environment, the compiler is not necessarily able to always construct proper relative imports. The compiler includes the `LogicalProjectStrategy` for this reason. This strategy is able to respect `rootDirs` to construct relative paths when possible. This logic currently accidentally triggers when there is a `rootDir` set. This option is not to be confused with the virtual directory option called `rootDirs`. The compiler currently confuses this and accidentally enters this mode when there is just a `rootDir`— breaking in monorepos that imports can point outside the `rootDir` to e.g. other compilation unit's `.d.ts` (which is valid; just not `.ts` sources can live outside the root dir). This is necessary for our Bazel toolchain migration. PR Close angular#60555
crisbeto
added a commit
to crisbeto/material2
that referenced
this pull request
Apr 5, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto
added a commit
to crisbeto/material2
that referenced
this pull request
Apr 5, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto
added a commit
to crisbeto/material2
that referenced
this pull request
Apr 5, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto
added a commit
to crisbeto/material2
that referenced
this pull request
Apr 7, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
crisbeto
added a commit
to angular/components
that referenced
this pull request
Apr 7, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
mistrykaran91
pushed a commit
to mistrykaran91/components
that referenced
this pull request
Apr 8, 2025
Updates the repo to the Angular 20.0.0-next.5 version which we need so we can move the `DOCUMENT` imports from `common` to `core`, and it allows us to remove a build patch because it includes angular/angular#60555
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
action: merge
The PR is ready for merge by the caretaker
area: compiler
Issues related to `ngc`, Angular's template compiler
merge: caretaker note
Alert the caretaker performing the merge to check the PR for an out of normal action needed or note
target: patch
This PR is targeted for the next patch release
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default, the compiler-cli uses the relative import strategy when there is no
rootDir
orrootDirs
. This is expected as everything is assumed to be somehow reachable through relative imports.With
rootDirs
that allow for a "virtual file system"-like environment, the compiler is not necessarily able to always construct proper relative imports. The compiler includes theLogicalProjectStrategy
for this reason. This strategy is able to respectrootDirs
to construct relative paths when possible.This logic currently accidentally triggers when there is a
rootDir
set. This option is not to be confused with the virtual directory option calledrootDirs
. The compiler currently confuses this and accidentally enters this mode when there is just arootDir
— breaking in monorepos that imports can point outside therootDir
to e.g. other compilation unit's.d.ts
(which is valid; just not.ts
sources can live outside the root dir).This is necessary for our Bazel toolchain migration.