Browse Source
chore: use esbuild-loader (#28859)
* chore: use esbuild-loader
* fix config
pull/28866/head
偏右
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
9 additions and
7 deletions
-
package.json
-
site/bisheng.config.js
-
webpack.config.js
|
|
@ -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", |
|
|
|
|
|
@ -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(), |
|
|
|
]; |
|
|
|
|
|
@ -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', |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|