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>
This commit is contained in:
Lunny Xiao 2021-04-02 08:11:04 +08:00 committed by GitHub
parent bc1f2117f1
commit 42efa14f51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 157 additions and 930 deletions

View file

@ -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'
},
},
],