-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Turbopack: Fix module_resolution: "nodenext"
with mjs
or cjs
#71635
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
import foo from "./src/foo.js"; | ||
import bar from "./src/bar.js"; | ||
import fooEsm from "./src/foo-esm.mjs"; | ||
import fooCjs from "./src/foo-cjs.cjs"; | ||
import fileTsx from "./src/file-tsx.js"; | ||
import fileMts from "./src/file-mts.mjs"; | ||
import fileCts from "./src/file-cts.cjs"; | ||
import fileMjs from "./src/file-mjs.mjs"; | ||
import fileCjs from "./src/file-cjs.cjs"; | ||
|
||
it("should correctly resolve explicit extensions with nodenext", () => { | ||
expect(foo).toBe("foo"); | ||
expect(bar).toBe("bar"); | ||
expect(fooEsm).toBe("fooEsm"); | ||
expect(fooCjs).toBe("fooCjs"); | ||
expect(foo).toBe("foo.ts"); | ||
expect(fileTsx).toBe("file-tsx"); | ||
expect(fileMts).toBe("file-mts"); | ||
expect(fileCts).toBe("file-cts"); | ||
expect(fileMjs).toBe("file-mjs"); | ||
expect(fileCjs).toBe("file-cjs"); | ||
}); | ||
|
||
// import fooButton from "foo/button"; | ||
|
||
// it("should correctly resolve explicit extensions with nodenext", () => { | ||
// expect(fooButton).toBe("button"); | ||
// }); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'file-cjs' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "file-cts"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default 'file-mjs' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "file-mts"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default "file-tsx"; |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export default "foo"; | ||
export default "foo.ts"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext" | ||
} | ||
"moduleResolution": "NodeNext", | ||
"allowJs": true, | ||
"outDir": "dist" | ||
}, | ||
"include": ["index.js"], | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix (and the same for
cjs
below). I also refactored some of the options handling around this