Skip to content

resolve from outDir - #48190

Closed
Alex Eagle (alexeagle) wants to merge 1 commit into
microsoft:mainfrom
alexeagle:resolveFromOutDir
Closed

Alex Eagle (alexeagle) wants to merge 1 commit into
microsoft:mainfrom
alexeagle:resolveFromOutDir

Conversation

@alexeagle

@alexeagle Alex Eagle (alexeagle) commented Mar 9, 2022 •

Copy link
Copy Markdown
Contributor

Under the new proposed compilerOptions.resolveFromOutDir boolean,
module resolution is attempted relative to the output folder.

This is analogous to loading from the rootDirs, however it allows
compilation where the output directory is configured on the command line
rather than in the tsconfig.json.

See the attached issue for context.

TODO:

  • figure out what tests to add
  • reason about whether this interacts correctly with other related
    module resolution conditional logic
  • verify this works in some Bazel projects where the problem is observed

Fixes #22208
Fixes #37378

@typescript-bot TypeScript Bot (typescript-bot) added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Mar 9, 2022
Proof of concept for resolving microsoft#37378

Under the new proposed `compilerOptions.resolveFromOutDir` boolean,
module resolution is attempted relative to the output folder.

This is analogous to loading from the rootDirs, however it allows
compilation where the output directory is configured on the command line
rather than in the tsconfig.json.

See the attached issue for context.

TODO:
- figure out what tests to add
- reason about whether this interacts correctly with other related
module resolution conditional logic
- verify this works in some Bazel projects where the problem is observed
@alexeagle Alex Eagle (alexeagle) changed the title hack: resolve from outDir resolve from outDir Mar 10, 2022
@typescript-bot TypeScript Bot (typescript-bot) added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Mar 10, 2022
@alexeagle
Alex Eagle (alexeagle) marked this pull request as ready for review March 10, 2022 23:41
Greg Magolan (gregmagolan) pushed a commit to alexeagle/TypeScript that referenced this pull request Mar 17, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the suggestion was to compute outDir for the referenced project and not change module resolution.

@alexeagle

Copy link
Copy Markdown
Contributor Author

Thanks Sheetal Nandi (@sheetalkamat) I replied on the associated issue about why this design was chosen.

@sandersn

Copy link
Copy Markdown
Member

Reading through the issue history, it looks like bazel doesn't need this PR anymore. I'm going to close it since I don't think Sheetal Nandi (@sheetalkamat) 's concerns ever changed.

Alex Eagle (@alexeagle) let me know if we should re-open this.

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

No way to use composite project where outDir is determined by build tool foo.ts is resolved before foo.d.ts even if the latter is in files[]

5 participants