diff --git a/src/node/utils/MinifyWorker.ts b/src/node/utils/MinifyWorker.ts index b6ec29e57..9c3419a33 100644 --- a/src/node/utils/MinifyWorker.ts +++ b/src/node/utils/MinifyWorker.ts @@ -3,13 +3,15 @@ * Worker thread to minify JS & CSS files out of the main NodeJS thread */ -import Terser from 'terser' const fsp = require('fs').promises; import path from 'node:path' -import Threads from 'threads' +import {expose} from 'threads' import lightminify from 'lightningcss' +import {transform} from 'esbuild'; -const compressJS = (content: string) => Terser.minify(content); +const compressJS = async (content: string) => { + return await transform(content, {minify: true}); +} const compressCSS = async (filename: string, ROOT_DIR: string) => { const absPath = path.resolve(ROOT_DIR, filename); @@ -30,7 +32,7 @@ const compressCSS = async (filename: string, ROOT_DIR: string) => { } }; -Threads.expose({ - compressJS, +expose({ + compressJS: compressJS, compressCSS, }); diff --git a/src/package.json b/src/package.json index d6de6cc47..2d0bc6800 100644 --- a/src/package.json +++ b/src/package.json @@ -69,7 +69,6 @@ "socket.io": "^4.7.5", "socket.io-client": "^4.7.5", "superagent": "^9.0.2", - "terser": "^5.30.3", "threads": "^1.7.0", "tinycon": "0.6.8", "tsx": "^4.11.2", @@ -97,6 +96,7 @@ "@types/sinon": "^17.0.3", "@types/supertest": "^6.0.2", "@types/underscore": "^1.11.15", + "esbuild": "^0.21.4", "eslint": "^9.2.0", "eslint-config-etherpad": "^4.0.4", "etherpad-cli-client": "^3.0.2",