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

fix(node): #1180 - Adjust tsconfig compiler options #1456

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
## Main

<!-- Your comment below this -->

- [#1180] Set module properly when tsconfig does not contain compilerOptions.module [@matthewh]
<!-- Your comment above this -->

## 12.3.2
Expand Down
12 changes: 8 additions & 4 deletions source/runner/runners/utils/transpiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,14 @@ const sanitizeTSConfig = (config: any, esm: boolean = false) => {
//
// @see https://github.com/apollographql/react-apollo/pull/1402#issuecomment-351810274
//
if (!esm && safeConfig.compilerOptions.module) {
safeConfig.compilerOptions.module = "commonjs"
} else {
safeConfig.compilerOptions.module = "es6"
if (safeConfig.compilerOptions.module) {
if (!esm) {
// .ts files should fall back to commonjs
safeConfig.compilerOptions.module = "commonjs"
} else {
// .mts files must use `import`/`export` syntax
safeConfig.compilerOptions.module = "es6"
}
}

return safeConfig
Expand Down