mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
refactor(schema): add top level esbuild
config
This commit is contained in:
parent
1608ce4cf2
commit
8373c444fb
@ -87,11 +87,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||
esbuild: {
|
||||
options: {
|
||||
exclude: excludePattern,
|
||||
tsconfigRaw: {
|
||||
compilerOptions: {
|
||||
experimentalDecorators: nuxt.options.experimental.decorators ?? false
|
||||
}
|
||||
}
|
||||
...nuxt.options.esbuild
|
||||
},
|
||||
},
|
||||
analyze: !nuxt.options.test && nuxt.options.build.analyze && (nuxt.options.build.analyze === true || nuxt.options.build.analyze.enabled)
|
||||
|
@ -46,6 +46,7 @@
|
||||
"@vue/compiler-sfc": "3.4.29",
|
||||
"@vue/language-core": "2.0.21",
|
||||
"c12": "1.11.1",
|
||||
"esbuild": "0.21.5",
|
||||
"esbuild-loader": "4.1.0",
|
||||
"h3": "1.11.1",
|
||||
"ignore": "5.3.1",
|
||||
|
21
packages/schema/src/config/esbuild.ts
Normal file
21
packages/schema/src/config/esbuild.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { defu } from 'defu'
|
||||
import { defineUntypedSchema } from 'untyped'
|
||||
import type { TransformOptions } from 'esbuild'
|
||||
|
||||
export default defineUntypedSchema({
|
||||
esbuild: {
|
||||
options: {
|
||||
jsxFactory: 'h',
|
||||
jsxFragment: 'Fragment',
|
||||
tsconfigRaw: {
|
||||
$resolve: async (val: TransformOptions['tsconfigRaw'], get) => {
|
||||
return defu(val, {
|
||||
compilerOptions: {
|
||||
experimentalDecorators: await get('experimental.decorators') as boolean
|
||||
}
|
||||
} satisfies TransformOptions['tsconfigRaw'])
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
@ -3,6 +3,7 @@ import app from './app'
|
||||
import build from './build'
|
||||
import common from './common'
|
||||
import dev from './dev'
|
||||
import esbuild from './esbuild'
|
||||
import experimental from './experimental'
|
||||
import generate from './generate'
|
||||
import internal from './internal'
|
||||
@ -26,6 +27,7 @@ export default {
|
||||
...postcss,
|
||||
...router,
|
||||
...typescript,
|
||||
...esbuild,
|
||||
...vite,
|
||||
...webpack,
|
||||
}
|
||||
|
@ -84,16 +84,8 @@ export default defineUntypedSchema({
|
||||
},
|
||||
},
|
||||
esbuild: {
|
||||
jsxFactory: 'h',
|
||||
jsxFragment: 'Fragment',
|
||||
tsconfigRaw: {
|
||||
$resolve: async (val: Exclude<ViteOptions['esbuild'], false>['tsconfigRaw'], get) => {
|
||||
return defu(val, {
|
||||
compilerOptions: {
|
||||
experimentalDecorators: await get('experimental.decorators') as boolean
|
||||
}
|
||||
} satisfies Exclude<ViteOptions['esbuild'], false>['tsconfigRaw'])
|
||||
}
|
||||
$resolve: async (val: Record<string, any>, get) => {
|
||||
return defu(val, await get('esbuild.options') as Record<string, any>)
|
||||
}
|
||||
},
|
||||
clearScreen: true,
|
||||
|
@ -159,16 +159,8 @@ export default defineUntypedSchema({
|
||||
* @type {Omit<typeof import('esbuild-loader')['LoaderOptions'], 'loader'>}
|
||||
*/
|
||||
esbuild: {
|
||||
jsxFactory: 'h',
|
||||
jsxFragment: 'Fragment',
|
||||
tsconfigRaw: {
|
||||
$resolve: async (val: LoaderOptions['tsconfigRaw'], get) => {
|
||||
return defu(val, {
|
||||
compilerOptions: {
|
||||
experimentalDecorators: await get('experimental.decorators') as boolean
|
||||
}
|
||||
} satisfies LoaderOptions['tsconfigRaw'])
|
||||
}
|
||||
$resolve: async (val: Record<string, any>, get) => {
|
||||
return defu(val, await get('esbuild.options') as Record<string, any>)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -533,9 +533,12 @@ importers:
|
||||
c12:
|
||||
specifier: 1.11.1
|
||||
version: 1.11.1(magicast@0.3.4)
|
||||
esbuild:
|
||||
specifier: 0.21.5
|
||||
version: 0.21.5
|
||||
esbuild-loader:
|
||||
specifier: 4.1.0
|
||||
version: 4.1.0(webpack@5.92.0)
|
||||
version: 4.1.0(webpack@5.92.0(esbuild@0.21.5))
|
||||
h3:
|
||||
specifier: 1.11.1
|
||||
version: 1.11.1
|
||||
@ -568,16 +571,16 @@ importers:
|
||||
version: 2.1.0
|
||||
vue-loader:
|
||||
specifier: 17.4.2
|
||||
version: 17.4.2(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5))(webpack@5.92.0)
|
||||
version: 17.4.2(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5))(webpack@5.92.0(esbuild@0.21.5))
|
||||
vue-router:
|
||||
specifier: 4.3.3
|
||||
version: 4.3.3(vue@3.4.29(typescript@5.4.5))
|
||||
webpack:
|
||||
specifier: 5.92.0
|
||||
version: 5.92.0
|
||||
version: 5.92.0(esbuild@0.21.5)
|
||||
webpack-dev-middleware:
|
||||
specifier: 7.2.1
|
||||
version: 7.2.1(webpack@5.92.0)
|
||||
version: 7.2.1(webpack@5.92.0(esbuild@0.21.5))
|
||||
|
||||
packages/ui-templates:
|
||||
devDependencies:
|
||||
@ -11165,6 +11168,14 @@ snapshots:
|
||||
|
||||
es-module-lexer@1.3.1: {}
|
||||
|
||||
esbuild-loader@4.1.0(webpack@5.92.0(esbuild@0.21.5)):
|
||||
dependencies:
|
||||
esbuild: 0.20.2
|
||||
get-tsconfig: 4.7.3
|
||||
loader-utils: 2.0.4
|
||||
webpack: 5.92.0(esbuild@0.21.5)
|
||||
webpack-sources: 1.4.3
|
||||
|
||||
esbuild-loader@4.1.0(webpack@5.92.0):
|
||||
dependencies:
|
||||
esbuild: 0.20.2
|
||||
@ -15224,6 +15235,16 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
vue-loader@17.4.2(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5))(webpack@5.92.0(esbuild@0.21.5)):
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
hash-sum: 2.0.0
|
||||
watchpack: 2.4.1
|
||||
webpack: 5.92.0(esbuild@0.21.5)
|
||||
optionalDependencies:
|
||||
'@vue/compiler-sfc': 3.4.29
|
||||
vue: 3.4.29(typescript@5.4.5)
|
||||
|
||||
vue-loader@17.4.2(@vue/compiler-sfc@3.4.29)(vue@3.4.29(typescript@5.4.5))(webpack@5.92.0):
|
||||
dependencies:
|
||||
chalk: 4.1.2
|
||||
@ -15305,6 +15326,17 @@ snapshots:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
webpack-dev-middleware@7.2.1(webpack@5.92.0(esbuild@0.21.5)):
|
||||
dependencies:
|
||||
colorette: 2.0.20
|
||||
memfs: 4.9.2
|
||||
mime-types: 2.1.35
|
||||
on-finished: 2.4.1
|
||||
range-parser: 1.2.1
|
||||
schema-utils: 4.2.0
|
||||
optionalDependencies:
|
||||
webpack: 5.92.0(esbuild@0.21.5)
|
||||
|
||||
webpack-dev-middleware@7.2.1(webpack@5.92.0):
|
||||
dependencies:
|
||||
colorette: 2.0.20
|
||||
|
Loading…
Reference in New Issue
Block a user