diff --git a/package.json b/package.json index 2253a85c41..2156a89d73 100644 --- a/package.json +++ b/package.json @@ -195,7 +195,7 @@ "enquire-js": "^0.2.1", "enzyme": "^3.10.0", "enzyme-to-json": "^3.6.0", - "esbuild-webpack-plugin": "^1.0.0", + "esbuild-loader": "^2.7.0", "eslint": "^7.9.0", "eslint-config-airbnb": "^18.0.0", "eslint-config-prettier": "^7.0.0", diff --git a/site/bisheng.config.js b/site/bisheng.config.js index 3ab016209e..7bddd1c38a 100644 --- a/site/bisheng.config.js +++ b/site/bisheng.config.js @@ -2,7 +2,7 @@ const path = require('path'); const replaceLib = require('@ant-design/tools/lib/replaceLib'); const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); -const EsbuildPlugin = require('esbuild-webpack-plugin').default; +const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader'); const { version } = require('../package.json'); const themeConfig = require('./themeConfig'); @@ -79,9 +79,10 @@ module.exports = { config.resolve.alias = { ...config.resolve.alias, react: require.resolve('react') }; } else if (process.env.ESBUILD) { // use esbuild + config.plugins.push(new ESBuildPlugin()); config.optimization.minimizer = [ - new EsbuildPlugin({ - target: 'chrome49', + new ESBuildMinifyPlugin({ + target: 'es2015', }), new CssMinimizerPlugin(), ]; diff --git a/webpack.config.js b/webpack.config.js index 3d9480bffa..d22aad0eaa 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -3,7 +3,7 @@ const getWebpackConfig = require('@ant-design/tools/lib/getWebpackConfig'); const IgnoreEmitPlugin = require('ignore-emit-webpack-plugin'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); -const EsbuildPlugin = require('esbuild-webpack-plugin').default; +const { ESBuildPlugin, ESBuildMinifyPlugin } = require('esbuild-loader'); const darkVars = require('./scripts/dark-vars'); const compactVars = require('./scripts/compact-vars'); @@ -99,8 +99,9 @@ if (process.env.RUN_ENV === 'PRODUCTION') { config.optimization.usedExports = true; // use esbuild if (process.env.ESBUILD || process.env.CSB_REPO) { - config.optimization.minimizer[0] = new EsbuildPlugin({ - target: 'chrome49', + config.plugins.push(new ESBuildPlugin()); + config.optimization.minimizer[0] = new ESBuildMinifyPlugin({ + target: 'es2015', }); }