fix(webpack): import esbuild-loader as commonjs (#2460)

This commit is contained in:
pooya parsa 2021-12-20 13:00:27 +01:00 committed by GitHub
parent 85f0547ca4
commit c288907f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
import { ESBuildMinifyPlugin } from 'esbuild-loader' import esbuildLoader from 'esbuild-loader'
import { WebpackConfigContext } from '../utils/config' import { WebpackConfigContext } from '../utils/config'
export function esbuild (ctx: WebpackConfigContext) { export function esbuild (ctx: WebpackConfigContext) {
@ -9,7 +9,8 @@ export function esbuild (ctx: WebpackConfigContext) {
// https://nodejs.org/en/ // https://nodejs.org/en/
const target = ctx.isServer ? 'es2019' : 'chrome85' 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( config.module.rules.push(
{ {