From ba484d5478ec6af9f28f9339116ea19ef6bba969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 6 Oct 2022 07:51:13 -0400 Subject: [PATCH] Esbuild (#10940) * ci: add minimum GitHub token permissions for workflows Signed-off-by: Ashish Kurmi * feat: use esbuild for minification Co-authored-by: Ashish Kurmi --- install/package.json | 2 ++ webpack.prod.js | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/install/package.json b/install/package.json index 4c0aeb6d30..1824a75876 100644 --- a/install/package.json +++ b/install/package.json @@ -58,6 +58,7 @@ "csurf": "1.11.0", "daemon": "1.1.0", "diff": "5.1.0", + "esbuild": "0.15.10", "express": "4.18.1", "express-session": "1.17.3", "express-useragent": "1.0.15", @@ -129,6 +130,7 @@ "sortablejs": "1.15.0", "spdx-license-list": "6.6.0", "spider-detector": "2.0.0", + "terser-webpack-plugin": "5.3.6", "textcomplete": "0.18.2", "textcomplete.contenteditable": "0.1.1", "timeago": "1.6.7", diff --git a/webpack.prod.js b/webpack.prod.js index 523e011f3d..4cecee7d9c 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -1,8 +1,19 @@ 'use strict'; const { merge } = require('webpack-merge'); +const TerserPlugin = require('terser-webpack-plugin'); + const common = require('./webpack.common'); module.exports = merge(common, { mode: 'production', + optimization: { + minimize: true, + minimizer: [ + new TerserPlugin({ + minify: TerserPlugin.esbuildMinify, + terserOptions: {}, + }), + ], + }, });