Skip to content
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

Add support for tsconfig 'nodenext' | 'node16' #44177

Merged
merged 25 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f93373d
add nodenext and node16 to tsconfig module options
Dec 20, 2022
f121a58
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Dec 20, 2022
1ddb6e6
add extensionAlias option for import with required extension with nod…
Dec 20, 2022
71c3859
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Dec 20, 2022
cccdf76
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Dec 20, 2022
54995f6
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Dec 22, 2022
a9ac06f
Merge branch 'canary' into tsconfig-module-nodenext-node16
ijjk Jan 3, 2023
c8ab6d9
revert extra change
ijjk Jan 3, 2023
a2c7e1e
Merge branch 'canary' into tsconfig-module-nodenext-node16
ijjk Jan 3, 2023
fed2784
Revert "revert extra change"
ijjk Jan 4, 2023
04c942e
Merge branch 'canary' into tsconfig-module-nodenext-node16
ijjk Jan 4, 2023
f008a9c
Merge pull request #1 from vercel/canary
loettz Jan 10, 2023
4218de7
Merge remote-tracking branch 'origin/canary' into tsconfig-module-nod…
Jan 10, 2023
6b49e8e
add test for webpack config extensionAlias
loettz Jan 10, 2023
df61741
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Jan 10, 2023
004f4bb
Merge branch 'canary' into tsconfig-module-nodenext-node16
ijjk Jan 10, 2023
67d4399
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Jan 11, 2023
e6b7cd0
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Jan 12, 2023
c30bd98
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Jan 16, 2023
be107ce
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Jan 19, 2023
e4c392c
Merge branch 'canary' into tsconfig-module-nodenext-node16
loettz Jan 23, 2023
825285f
Merge branch 'canary' into tsconfig-module-nodenext-node16
styfle Jan 27, 2023
a310c94
Merge branch 'canary' into tsconfig-module-nodenext-node16
styfle Jan 27, 2023
177048d
Merge branch 'canary' into tsconfig-module-nodenext-node16
ijjk Jan 27, 2023
74c252f
Merge branch 'canary' into tsconfig-module-nodenext-node16
styfle Jan 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function getDesiredCompilerOptions(
ts.ModuleKind.ESNext,
ts.ModuleKind.CommonJS,
ts.ModuleKind.AMD,
ts.ModuleKind.NodeNext,
ts.ModuleKind.Node16,
],
value: 'esnext',
reason: 'for dynamic import() support',
Expand Down
50 changes: 50 additions & 0 deletions test/integration/tsconfig-verifier/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,56 @@ describe('tsconfig.json verifier', () => {
`)
})

it('allows you to set node16 module mode', async () => {
expect(await exists(tsConfig)).toBe(false)

await writeFile(
tsConfig,
`{ "compilerOptions": { "esModuleInterop": false, "module": "node16", "moduleResolution": "node16" } }`
)
await new Promise((resolve) => setTimeout(resolve, 500))
const { code, stderr, stdout } = await nextBuild(appDir, undefined, {
stderr: true,
stdout: true,
})
expect(stderr + stdout).not.toContain('moduleResolution')
expect(code).toBe(0)

expect(await readFile(tsConfig, 'utf8')).toMatchInlineSnapshot(`
"{
\\"compilerOptions\\": {
\\"esModuleInterop\\": true,
\\"module\\": \\"node16\\",
\\"moduleResolution\\": \\"node16\\",
\\"target\\": \\"es5\\",
\\"lib\\": [
\\"dom\\",
\\"dom.iterable\\",
\\"esnext\\"
],
\\"allowJs\\": true,
\\"skipLibCheck\\": true,
\\"strict\\": false,
\\"forceConsistentCasingInFileNames\\": true,
\\"noEmit\\": true,
\\"incremental\\": true,
\\"resolveJsonModule\\": true,
\\"isolatedModules\\": true,
\\"jsx\\": \\"preserve\\"
},
\\"include\\": [
\\"next-env.d.ts\\",
\\"**/*.ts\\",
\\"**/*.tsx\\"
],
\\"exclude\\": [
\\"node_modules\\"
]
}
"
`)
})

it('allows you to extend another configuration file', async () => {
expect(await exists(tsConfig)).toBe(false)
expect(await exists(tsConfigBase)).toBe(false)
Expand Down