Browse Source

chore: use esbuild-loader (#28859)

* chore: use esbuild-loader

* fix config
pull/28866/head
偏右 4 years ago
committed by GitHub
parent
commit
e3214c896f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      package.json
  2. 7
      site/bisheng.config.js
  3. 7
      webpack.config.js

2
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",

7
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(),
];

7
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',
});
}

Loading…
Cancel
Save