feat(webpack): allow configuring esbuild-loader options (#21436)

This commit is contained in:
Daniel Roe 2023-06-07 13:50:12 +01:00 committed by GitHub
parent f0ade90645
commit 525a06af38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 10 deletions

View File

@ -43,6 +43,7 @@ export default defineBuildConfig({
'consola',
'ignore',
'vue-loader',
'esbuild-loader',
// Implicit
'@vue/compiler-core',
'@vue/shared',

View File

@ -30,6 +30,7 @@
"@unhead/schema": "1.1.27",
"@vitejs/plugin-vue": "4.2.3",
"@vitejs/plugin-vue-jsx": "3.0.1",
"esbuild-loader": "^3.0.1",
"h3": "1.6.6",
"ignore": "5.2.4",
"nitropack": "2.4.1",

View File

@ -147,6 +147,8 @@ export default defineUntypedSchema({
}
return val
},
/** @type {typeof import('esbuild-loader')['LoaderOptions']} */
esbuild: {},
file: { esModule: false },
fontUrl: { esModule: false, limit: 1000 },
imgUrl: { esModule: false, limit: 1000 },

View File

@ -27,16 +27,18 @@ export function esbuild (ctx: WebpackConfigContext) {
fullySpecified: false
},
options: {
loader: 'ts',
target
target,
...ctx.nuxt.options.webpack.loaders.esbuild,
loader: 'ts'
}
},
{
test: /\.m?[jt]sx$/,
loader: 'esbuild-loader',
options: {
loader: 'tsx',
target
target,
...ctx.nuxt.options.webpack.loaders.esbuild,
loader: 'tsx'
}
}
)

View File

@ -543,6 +543,9 @@ importers:
'@vitejs/plugin-vue-jsx':
specifier: 3.0.1
version: 3.0.1(vite@4.3.9)(vue@3.3.4)
esbuild-loader:
specifier: ^3.0.1
version: 3.0.1(webpack@5.85.1)
h3:
specifier: 1.6.6
version: 1.6.6
@ -3106,7 +3109,6 @@ packages:
/big.js@5.2.2:
resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==}
dev: false
/binary-extensions@2.2.0:
resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==}
@ -3971,7 +3973,6 @@ packages:
/emojis-list@3.0.0:
resolution: {integrity: sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==}
engines: {node: '>= 4'}
dev: false
/encodeurl@1.0.2:
resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
@ -4102,7 +4103,6 @@ packages:
loader-utils: 2.0.4
webpack: 5.85.1
webpack-sources: 1.4.3
dev: false
/esbuild@0.17.19:
resolution: {integrity: sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==}
@ -5769,7 +5769,6 @@ packages:
big.js: 5.2.2
emojis-list: 3.0.0
json5: 2.2.3
dev: false
/local-pkg@0.4.3:
resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==}
@ -7479,7 +7478,6 @@ packages:
/source-list-map@2.0.1:
resolution: {integrity: sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==}
dev: false
/source-map-js@1.0.2:
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
@ -8565,7 +8563,6 @@ packages:
dependencies:
source-list-map: 2.0.1
source-map: 0.6.1
dev: false
/webpack-sources@3.2.3:
resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==}