-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TSConfig extends pointing to node module (vercel/turborepo#4772)
In #4754, I screwed up the resolution logic for configs that reference another config inside a node module. In it, I incorrectly joined `/tsconfig.json` before performing any lookup, because I thought the joining was happening in the `combinePaths` in https://github.com/microsoft/TypeScript/blob/611a912d/src/compiler/commandLineParser.ts#L3315. But, that combine has no real affect, it immediately gets stripped in a call to `getDirectoryPath` in https://github.com/microsoft/TypeScript/blob/611a912d/src/compiler/moduleNameResolver.ts#LL1703C93-L1703. Instead, it performs a basic `node_module` lookup using the input module name, and even tries to load the file referenced at that location (eg, it's a `extends: 'foo/tsconfig.json'`). If that fails, then it combines with an implied `/tsconfig` the same way a `/index` is appended when doing `require('./directory')`. Fixes WEB-974
- Loading branch information
1 parent
a039a4b
commit 9b9f971
Showing
29 changed files
with
3,593 additions
and
16 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
crates/turbopack-tests/tests/node_modules/tsconfig-mod/tsconfig.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
1 change: 1 addition & 0 deletions
1
crates/turbopack-tests/tests/snapshot/typescript/tsconfig-baseurl/input/foo.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const prop = "prop"; |
5 changes: 5 additions & 0 deletions
5
...urbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/input/index.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { prop as globalFoo } from "foo"; | ||
import { prop as localFoo } from "./foo"; | ||
import { prop as atFoo } from "@/foo"; | ||
|
||
console.log(globalFoo, localFoo, atFoo); |
3 changes: 3 additions & 0 deletions
3
...ack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/input/tsconfig.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "tsconfig-mod/tsconfig.json" | ||
} |
3 changes: 3 additions & 0 deletions
3
.../turbopack-tests/tests/snapshot/typescript/tsconfig-extends-module-full-path/options.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"entry": "input/index.ts" | ||
} |
13 changes: 13 additions & 0 deletions
13
...ypescript/tsconfig-extends-module-full-path/output/63a02_tsconfig-mod_prop.ts_2aa573._.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...cript/tsconfig-extends-module-full-path/output/63a02_tsconfig-mod_prop.ts_2aa573._.js.map
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.