useDefineForClassFields
value changed from 3.1 when it's derived from target
#10296
Closed
7 tasks done
Labels
p4-important
Violate documented behavior or significantly improves performance (priority)
Describe the bug
When
useDefineForClassFields
is not set intsconfig
, the value is derived fromtarget
.When
target
isES2022
+ orESNext
,useDefineForClassFields
istrue
otherwise it'sfalse
.This is documented here as well.
But it seems this was not working and still not working in some cases.
related: #10167, #10292
tsconfig.compilerOptions.target = 'ESNext'
&&build.target = 'ESNext'
useDefineForClassFields
false
false
true
true
The behavior changed but I think the new behavior is correct.
tsconfig.compilerOptions.target = 'ES2021'
&&build.target = 'ES2021'
useDefineForClassFields
false
false
true
true
The behavior changed and I think the new behavior is not correct.
tsconfig.compilerOptions.target = 'ESNext'
&&build.target = 'ES2021'
useDefineForClassFields
false
false
true
true
The behavior changed but I think the new behavior is correct.
tsconfig.compilerOptions.target = 'ES2021'
&&build.target = 'ESNext'
useDefineForClassFields
false
false
true
true
The behavior changed and I think the new behavior is not correct.
I think
useDefineForClassFields
should be derived fromtsconfig.compilerOptions.target
and not frombuild.target
.related esbuild's behavior
Before esbuild 0.15.8, esbuild derived
useDefineForClassFields
frombuild.target
and not fromtsconfig.compilerOptions.target
. But from 0.15.8, it seems the behavior changed.When
target = 'es2021'
+tsconfig.compilerOptions.target = 'esnext'
, I think the new behavior is correct.When
target = 'esnext'
+tsconfig.compilerOptions.target = 'es2021'
, I think the behavior might not be correct.esbuild repl 0.15.7
target = 'es2021'
+tsconfig.compilerOptions.target = 'esnext'
esbuild repl 0.15.8
target = 'es2021'
+tsconfig.compilerOptions.target = 'esnext'
esbuild repl 0.15.7
target = 'esnext'
+tsconfig.compilerOptions.target = 'es2021'
esbuild repl 0.15.8
target = 'esnext'
+tsconfig.compilerOptions.target = 'es2021'
Reproduction
https://stackblitz.com/edit/vitejs-vite-tkrvzm (Vite 3.0.9 &&
tsconfig.compilerOptions.target = 'ESNext'
&&build.target = 'ES2021'
)System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: