适配x9
This commit is contained in:
+21
-34
@@ -176,7 +176,7 @@ const plugins = [
|
||||
|
||||
export default defineConfig({
|
||||
plugins,
|
||||
base: process.env.NODE_ENV === "production" ? "/x8/v2/" : "/",
|
||||
base: process.env.NODE_ENV === "production" ? "/x9/v2/" : "/",
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(import.meta.dirname, "client", "src"),
|
||||
@@ -208,48 +208,35 @@ export default defineConfig({
|
||||
manualChunks(id) {
|
||||
if (!id.includes("node_modules")) return;
|
||||
|
||||
// Keep core runtime dependencies stable for better long-term caching.
|
||||
if (id.includes("node_modules/react/") || id.includes("node_modules/react-dom/")) {
|
||||
if (
|
||||
id.includes("/echarts/") ||
|
||||
id.includes("/zrender/") ||
|
||||
id.includes("\\echarts\\") ||
|
||||
id.includes("\\zrender\\")
|
||||
) {
|
||||
return "echarts-vendor";
|
||||
}
|
||||
|
||||
if (id.includes("/react-dom/") || id.includes("/react/")) {
|
||||
return "react-vendor";
|
||||
}
|
||||
if (id.includes("node_modules/wouter/")) {
|
||||
return "router-vendor";
|
||||
}
|
||||
|
||||
// Split large libraries into their own chunks to avoid a single huge entry bundle.
|
||||
if (id.includes("node_modules/echarts/")) return "echarts-vendor";
|
||||
if (id.includes("node_modules/recharts/")) return "recharts-vendor";
|
||||
if (id.includes("node_modules/framer-motion/")) return "motion-vendor";
|
||||
if (id.includes("node_modules/@radix-ui/")) return "radix-vendor";
|
||||
|
||||
// Group frequently used small UI helpers.
|
||||
if (id.includes("/wouter/")) return "router-vendor";
|
||||
if (id.includes("/@radix-ui/")) return "radix-vendor";
|
||||
if (id.includes("/framer-motion/")) return "motion-vendor";
|
||||
if (
|
||||
id.includes("node_modules/lucide-react/") ||
|
||||
id.includes("node_modules/class-variance-authority/") ||
|
||||
id.includes("node_modules/clsx/") ||
|
||||
id.includes("node_modules/tailwind-merge/")
|
||||
id.includes("/lucide-react/") ||
|
||||
id.includes("/recharts/") ||
|
||||
id.includes("/class-variance-authority/") ||
|
||||
id.includes("/clsx/") ||
|
||||
id.includes("/tailwind-merge/")
|
||||
) {
|
||||
return "ui-vendor";
|
||||
}
|
||||
|
||||
// Fall back to per-package vendor chunks.
|
||||
const packageMatch = id.match(
|
||||
/node_modules[\\/](?:\.pnpm[\\/][^\\/]+[\\/]node_modules[\\/])?(@?[^\\/]+(?:[\\/][^\\/]+)?)/,
|
||||
);
|
||||
const packagePath = packageMatch?.[1];
|
||||
if (!packagePath) return "vendor";
|
||||
|
||||
const packageName = packagePath.startsWith("@")
|
||||
? packagePath.split(/[\\/]/).slice(0, 2).join("_")
|
||||
: packagePath.split(/[\\/]/)[0];
|
||||
|
||||
return `vendor-${packageName}`;
|
||||
},
|
||||
// Prevent Rollup from merging manual chunks back into larger bundles.
|
||||
onlyExplicitManualChunks: true,
|
||||
},
|
||||
},
|
||||
chunkSizeWarningLimit: 500,
|
||||
// echarts full build is ~1.1 MB; only loaded on /eq and /effects (lazy routes).
|
||||
chunkSizeWarningLimit: 1200,
|
||||
cssCodeSplit: true,
|
||||
},
|
||||
server: {
|
||||
|
||||
Reference in New Issue
Block a user