Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refactor: esbuild handles target and useDefineForClassFields (#7698)
  • Loading branch information
sodatea committed Apr 12, 2022
1 parent 66b6dc5 commit 0c928aa
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/vite/src/node/plugins/esbuild.ts
Expand Up @@ -81,6 +81,7 @@ export async function transformWithEsbuild(
// these fields would affect the compilation result
// https://esbuild.github.io/content-types/#tsconfig-json
const meaningfulFields: Array<keyof TSCompilerOptions> = [
'target',
'jsxFactory',
'jsxFragmentFactory',
'useDefineForClassFields',
Expand All @@ -98,17 +99,9 @@ export async function transformWithEsbuild(
compilerOptionsForFile[field] = loadedCompilerOptions[field]
}
}

// align with TypeScript 4.3
// https://github.com/microsoft/TypeScript/pull/42663
if (loadedCompilerOptions.target?.toLowerCase() === 'esnext') {
compilerOptionsForFile.useDefineForClassFields =
loadedCompilerOptions.useDefineForClassFields ?? true
}
}

tsconfigRaw = {
...tsconfigRaw,
compilerOptions: {
...compilerOptionsForFile,
...tsconfigRaw?.compilerOptions
Expand Down

0 comments on commit 0c928aa

Please sign in to comment.