Replace UglifyJSWebpackPlugin 0.x included in webpack with UglifyJsWebpackPlugin 1.x (from git because it supports terser without yarn resolution hacks - should be released as 1.2.8 soon)
Remove DefinePlugin for process.env.NODE_ENV since webpack 4 sets it by default according to the --mode flag
Replace the ummaintained uglify-js with the maintained fork terser and use it as the minimizer
Replace deprecated babel presets with babel-preset-env
Set up different babel configurations to allow tree shaking when appropriate (UMD builds get about 20% smaller as a result)
Add babel compiled output dir es which is like dist except with ES6 modules, and point the module field in package.json to it. Allows users with tree shaking set up to take advantage of it automatically.
yarn
andyarn run prepublish
, now succeed.Changes:
UglifyJSWebpackPlugin
0.x included in webpack with UglifyJsWebpackPlugin 1.x (from git because it supportsterser
without yarn resolution hacks - should be released as 1.2.8 soon)DefinePlugin
forprocess.env.NODE_ENV
since webpack 4 sets it by default according to the--mode
flaguglify-js
with the maintained forkterser
and use it as the minimizerbabel-preset-env
es
which is likedist
except with ES6 modules, and point themodule
field inpackage.json
to it. Allows users with tree shaking set up to take advantage of it automatically.