Skip to content

Commit

Permalink
fix: support for "module": "node16"/"nodenext" (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh authored Oct 16, 2024
1 parent 51f24be commit ec3fe9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,17 @@ function moduleType(
'es2020',
'es2022',
'esnext',
'node16',
'nodenext',
'none',
] as const
if (es6Modules.includes(module as any)) {
return 'es6'
}

const packageJson = getPackageJson(cwd)
if (packageJson?.type === 'module') {
const nodeModules = [
'node16',
'nodenext',
] as const
if (nodeModules.includes(module as any) && getPackageJson(cwd)?.type === 'module') {
return 'es6'
}

Expand Down
1 change: 1 addition & 0 deletions test/fixtures/tsconfig-with-package-json/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"module": "node16",
"target": "esnext",
"strict": true
}
Expand Down

0 comments on commit ec3fe9d

Please sign in to comment.