mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 18:46:49 +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:
Generated
+1
-1
@@ -104,6 +104,7 @@
|
||||
"sinon-chai": "^4.0.0",
|
||||
"style-loader": "^4.0.0",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"terser-webpack-plugin": "^5.3.14",
|
||||
"ts-loader": "^9.5.2",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tsx": "^4.17.0",
|
||||
@@ -19028,7 +19029,6 @@
|
||||
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz",
|
||||
"integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.25",
|
||||
"jest-worker": "^27.4.5",
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
"sinon-chai": "^4.0.0",
|
||||
"style-loader": "^4.0.0",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"terser-webpack-plugin": "^5.3.14",
|
||||
"ts-loader": "^9.5.2",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"tsx": "^4.17.0",
|
||||
|
||||
@@ -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