diff --git a/packages/schema/build.config.ts b/packages/schema/build.config.ts index dafbb0e911..a378333dcd 100644 --- a/packages/schema/build.config.ts +++ b/packages/schema/build.config.ts @@ -43,6 +43,7 @@ export default defineBuildConfig({ 'consola', 'ignore', 'vue-loader', + 'esbuild-loader', // Implicit '@vue/compiler-core', '@vue/shared', diff --git a/packages/schema/package.json b/packages/schema/package.json index 9a4685680b..b0488029cb 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -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", diff --git a/packages/schema/src/config/webpack.ts b/packages/schema/src/config/webpack.ts index eacfaf322a..1b0344b431 100644 --- a/packages/schema/src/config/webpack.ts +++ b/packages/schema/src/config/webpack.ts @@ -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 }, diff --git a/packages/webpack/src/presets/esbuild.ts b/packages/webpack/src/presets/esbuild.ts index 11222497a4..4c039d50b5 100644 --- a/packages/webpack/src/presets/esbuild.ts +++ b/packages/webpack/src/presets/esbuild.ts @@ -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' } } ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c24d023ecf..d785229648 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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==}