From c288907f7203cc5638077340d067898231887ccc Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Mon, 20 Dec 2021 13:00:27 +0100 Subject: [PATCH] fix(webpack): import `esbuild-loader` as commonjs (#2460) --- packages/webpack/src/presets/esbuild.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/webpack/src/presets/esbuild.ts b/packages/webpack/src/presets/esbuild.ts index 27a90c2356..0785b33088 100644 --- a/packages/webpack/src/presets/esbuild.ts +++ b/packages/webpack/src/presets/esbuild.ts @@ -1,4 +1,4 @@ -import { ESBuildMinifyPlugin } from 'esbuild-loader' +import esbuildLoader from 'esbuild-loader' import { WebpackConfigContext } from '../utils/config' export function esbuild (ctx: WebpackConfigContext) { @@ -9,7 +9,8 @@ export function esbuild (ctx: WebpackConfigContext) { // https://nodejs.org/en/ const target = ctx.isServer ? 'es2019' : 'chrome85' - config.optimization.minimizer.push(new ESBuildMinifyPlugin()) + // https://github.com/nuxt/framework/issues/2372 + config.optimization.minimizer.push(new (esbuildLoader as unknown as typeof import('esbuild-loader')).ESBuildMinifyPlugin()) config.module.rules.push( {