-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Introduce esbuild on webpack #14578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce esbuild on webpack #14578
Changes from 11 commits
1918c68
b938e47
31c2c97
113c2d4
28479bb
4a3f900
f7cbdc4
0083bda
ca2ff2c
1e11274
c3172e6
3a21b1e
ee9cd84
be0b41f
09b9801
f7fdee3
6093bb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ audit=false | |
fund=false | ||
package-lock=true | ||
save-exact=true | ||
cache=.npm-cache |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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 {ESBuildPlugin, 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', // Syntax to compile to (see options below for possible values) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(there are no options below to see) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||||||
|
@@ -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' // Syntax to compile to (see options below for possible values) | ||||||
6543 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
}, | ||||||
}, | ||||||
], | ||||||
|
@@ -239,6 +207,7 @@ module.exports = { | |||||
}, | ||||||
plugins: [ | ||||||
new VueLoaderPlugin(), | ||||||
new ESBuildPlugin(), | ||||||
new MiniCssExtractPlugin({ | ||||||
filename: 'css/[name].css', | ||||||
chunkFilename: 'css/[name].css', | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these
fsevents
can be dropped, they are generally considered optional dependencies, so nothing should break if they are not there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I wonder where they are required in first place. I know some webpack 4 modules did need them as a optional dependency to
chokidar
but if I run anpm ls fsevents
ornpm ls chokidar
on a Mac on master, I get an empty result. So maybe they are already obsolete?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay those are actually for
gulp
, which requireschokidar@2
andfsevents@1
.fsevents@2
isn't needed by anything as of now. My bad. PR is on the way.