mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-18 18:12:48 +00:00
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:
@@ -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
|
||||
? {}
|
||||
|
||||
Reference in New Issue
Block a user