mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-25 10:08:29 +00:00
fix(kit,schema): set esbuild target for experimental decorators (#31089)
This commit is contained in:
parent
fc33958173
commit
68348cde1d
@ -200,7 +200,6 @@ export async function _generateTypes (nuxt: Nuxt) {
|
||||
/* Decorator support */
|
||||
...useDecorators
|
||||
? {
|
||||
useDefineForClassFields: false,
|
||||
experimentalDecorators: false,
|
||||
}
|
||||
: {},
|
||||
|
@ -9,6 +9,19 @@ export default defineResolvers({
|
||||
* @type {import('esbuild').TransformOptions}
|
||||
*/
|
||||
options: {
|
||||
target: {
|
||||
$resolve: async (val, get) => {
|
||||
if (typeof val === 'string') {
|
||||
return val
|
||||
}
|
||||
// https://github.com/vitejs/vite-plugin-vue/issues/528
|
||||
const useDecorators = await get('experimental').then(r => r?.decorators === true)
|
||||
if (useDecorators) {
|
||||
return 'es2024'
|
||||
}
|
||||
return 'esnext'
|
||||
},
|
||||
},
|
||||
jsxFactory: 'h',
|
||||
jsxFragment: 'Fragment',
|
||||
tsconfigRaw: {
|
||||
@ -19,12 +32,12 @@ export default defineResolvers({
|
||||
if (!useDecorators) {
|
||||
return val
|
||||
}
|
||||
return defu(val, {
|
||||
// Force experimentalDecorators to false if decorators are enabled
|
||||
return defu({
|
||||
compilerOptions: {
|
||||
useDefineForClassFields: false,
|
||||
experimentalDecorators: false,
|
||||
},
|
||||
} satisfies TransformOptions['tsconfigRaw'])
|
||||
} satisfies TransformOptions['tsconfigRaw'], val)
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user