diff options
author | Lunny Xiao | 2021-04-02 08:11:04 +0800 |
---|---|---|
committer | GitHub | 2021-04-02 02:11:04 +0200 |
commit | 42efa14f51587542db9e118812171d2dcbe2b385 (patch) | |
tree | f549b971f6e41125c51973fc01123dd4c92f7ce0 /webpack.config.js | |
parent | bc1f2117f1be539e971c90877658a8e456ce9e25 (diff) |
Introduce esbuild on webpack (#14578)
* Vendor node mods as cache; fix esbuild/fomantic offline build
* Fix --exclude; use bsdtar for consistent globbing
* Fall back to GNU tar; forward-compatible for APT 2.0
* Avoid having extd. attrs with bsdtar
* Dependency and misc. optimizations
* Remove extra code after esbuild-loader update
Co-authored-by: Mike L <cl.jeremy@qq.com>
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 44 |
1 files changed, 6 insertions, 38 deletions
diff --git a/webpack.config.js b/webpack.config.js index 11c92e874..902654dd3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,9 +5,8 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const LicenseCheckerWebpackPlugin = require('license-checker-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); -const TerserPlugin = require('terser-webpack-plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin'); -const {statSync} = require('fs'); +const {ESBuildMinifyPlugin} = require('esbuild-loader'); const {resolve, parse} = require('path'); const {SourceMapDevToolPlugin} = require('webpack'); @@ -78,13 +77,9 @@ module.exports = { optimization: { minimize: isProduction, minimizer: [ - new TerserPlugin({ - extractComments: false, - terserOptions: { - output: { - comments: false, - }, - }, + new ESBuildMinifyPlugin({ + target: 'es2015', + minify: true }), new CssMinimizerPlugin({ sourceMap: true, @@ -131,36 +126,9 @@ module.exports = { exclude: /node_modules/, use: [ { - loader: 'babel-loader', + loader: 'esbuild-loader', options: { - sourceMaps: true, - cacheDirectory: true, - cacheCompression: false, - cacheIdentifier: [ - resolve(__dirname, 'package.json'), - resolve(__dirname, 'package-lock.json'), - resolve(__dirname, 'webpack.config.js'), - ].map((path) => statSync(path).mtime.getTime()).join(':'), - presets: [ - [ - '@babel/preset-env', - { - useBuiltIns: 'usage', - corejs: 3, - }, - ], - ], - plugins: [ - [ - '@babel/plugin-transform-runtime', - { - regenerator: true, - } - ], - ], - generatorOpts: { - compact: false, - }, + target: 'es2015' }, }, ], |