Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Introduce esbuild on webpack
  • Loading branch information
lunny committed Feb 6, 2021
commit 1918c68e5edd22fb38e1a752906bbba91646fc80
74 changes: 61 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"css-minimizer-webpack-plugin": "1.2.0",
"dropzone": "5.7.2",
"easymde": "2.13.0",
"esbuild-loader": "2.8.0",
"escape-goat": "3.0.0",
"fast-glob": "3.2.4",
"file-loader": "6.2.0",
Expand Down
47 changes: 10 additions & 37 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ 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 {
ESBuildPlugin,
ESBuildMinifyPlugin
} = require('esbuild-loader');
const {statSync} = require('fs');
const {resolve, parse} = require('path');
const {SourceMapDevToolPlugin} = require('webpack');
Expand Down Expand Up @@ -78,13 +81,9 @@ module.exports = {
optimization: {
minimize: isProduction,
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
output: {
comments: false,
},
},
new ESBuildMinifyPlugin({
target: 'es2015', // Syntax to compile to (see options below for possible values)
Copy link
Member

@6543 6543 Mar 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
target: 'es2015', // Syntax to compile to (see options below for possible values)
target: 'es2015',

(there are no options below to see)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

(This comment was copied from the module README, should not be there)

minify: true
}),
new CssMinimizerPlugin({
sourceMap: true,
Expand Down Expand Up @@ -131,36 +130,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' // Syntax to compile to (see options below for possible values)
},
},
],
Expand Down Expand Up @@ -243,6 +215,7 @@ module.exports = {
},
plugins: [
new VueLoaderPlugin(),
new ESBuildPlugin(),
new MiniCssExtractPlugin({
filename: 'css/[name].css',
chunkFilename: 'css/[name].css',
Expand Down