cli: switch to using esbuild for minifcation

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-01-05 00:37:13 +01:00
parent ffdb98aa29
commit f302d24d34
4 changed files with 37 additions and 17 deletions
+2 -1
View File
@@ -61,7 +61,8 @@
"commander": "^6.1.0",
"css-loader": "^6.5.1",
"diff": "^5.0.0",
"esbuild": "^0.14.1",
"esbuild": "^0.14.10",
"esbuild-loader": "^2.18.0",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
"eslint-formatter-friendly": "^7.0.0",
+7 -13
View File
@@ -14,10 +14,9 @@
* limitations under the License.
*/
import { WebpackOptionsNormalized, WebpackPluginInstance } from 'webpack';
import TerserPlugin from 'terser-webpack-plugin';
import { WebpackOptionsNormalized } from 'webpack';
import { BundlingOptions } from './types';
import { isParallelDefault } from '../parallel';
import { ESBuildMinifyPlugin } from 'esbuild-loader';
export const optimization = (
options: BundlingOptions,
@@ -26,16 +25,11 @@ export const optimization = (
return {
minimize: !isDev,
// Only configure when parallel is explicitly overridden from the default
...(!isParallelDefault(options.parallel)
? {
minimizer: [
new TerserPlugin({
parallel: options.parallel,
}) as unknown as WebpackPluginInstance,
],
}
: {}),
minimizer: [
new ESBuildMinifyPlugin({
target: 'es2019',
}),
],
runtimeChunk: 'single',
splitChunks: {
automaticNameDelimiter: '-',