Add TerserPlugin to preserve layer class names in production builds

- Install terser-webpack-plugin dependency
- Configure keep_classnames with regex pattern for layer classes
- Preserve names for FrameProfiler layer identification in production
- Covers most layer classes with regex, handles exceptions explicitly
This commit is contained in:
scamiv
2025-11-22 17:14:37 +01:00
parent c3796acd9b
commit 1f1e0341cf
3 changed files with 22 additions and 1 deletions
+20
View File
@@ -3,6 +3,7 @@ import CopyPlugin from "copy-webpack-plugin";
import ESLintPlugin from "eslint-webpack-plugin";
import HtmlWebpackPlugin from "html-webpack-plugin";
import path from "path";
import TerserPlugin from "terser-webpack-plugin";
import { fileURLToPath } from "url";
import webpack from "webpack";
@@ -169,6 +170,25 @@ export default async (env, argv) => {
},
},
},
minimizer: isProduction
? [
new TerserPlugin({
terserOptions: {
keep_classnames: (name) =>
/Layer$|Display$|Menu$|Timer$|Sidebar$|Panel$|Overlay$|Modal$/.test(
name,
) ||
name === "Leaderboard" ||
name === "TeamStats" ||
name === "HeadsUpMessage" ||
name === "AlertFrame" ||
name === "TerritoryWebGLStatus" ||
name === "MainRadialMenu" ||
name === "AdTimer",
},
}),
]
: [],
},
devServer: isProduction
? {}