From 3cb2520177c2944cc2d364cb09e4c51e84c2b206 Mon Sep 17 00:00:00 2001 From: lesleyrs <19632758+lesleyrs@users.noreply.github.com> Date: Mon, 29 Jul 2024 00:28:40 +0200 Subject: [PATCH] fix: terser workaround --- webpack.config.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 120ffb11..bf5bebb0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,6 @@ const webpack = require('webpack'); const path = require('path'); +const fs = require('fs'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); @@ -7,6 +8,7 @@ const CopyPlugin = require('copy-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); const isProduction = process.env.NODE_ENV === 'production'; +const isWebWorker = fs.existsSync('src/public/worker.js') || fs.existsSync('src/public/LoginThread.js') const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader'; const pages = [ @@ -124,10 +126,8 @@ module.exports = () => { minify: TerserPlugin.terserMinify, parallel: true, terserOptions: { - module: true, - mangle: true, - /* - mangle: { + module: isWebWorker, + mangle: isWebWorker ? true : { properties: { keep_quoted: true, // needed for tinymidipcm.mjs reserved: [ @@ -402,7 +402,6 @@ module.exports = () => { quote_style: 3, // original keep_quoted_props: true // needed for tinymidipcm.mjs } - */ } }) );