Refactor build and start scripts in package.json; add plugin to exclude debug files from production build in vite.config.ts; remove ConnectScreen component and replace with ConnectionPlaceholder in multiple pages; update DeviceContext to auto-connect using device IP from URL; enhance locale files with new device IP labels.
This commit is contained in:
+25
-3
@@ -150,11 +150,33 @@ function vitePluginManusDebugCollector(): Plugin {
|
||||
};
|
||||
}
|
||||
|
||||
const plugins = [react(), tailwindcss(), jsxLocPlugin(), vitePluginManusRuntime(), vitePluginManusDebugCollector()];
|
||||
/** 生产构建时剔除 public 中的 __manus__(仅开发调试使用) */
|
||||
function vitePluginExcludeManusFromDist(): Plugin {
|
||||
const distDir = path.resolve(import.meta.dirname, "dist");
|
||||
return {
|
||||
name: "exclude-manus-from-dist",
|
||||
closeBundle() {
|
||||
if (process.env.NODE_ENV !== "production") return;
|
||||
const manusDir = path.join(distDir, "__manus__");
|
||||
if (fs.existsSync(manusDir)) {
|
||||
fs.rmSync(manusDir, { recursive: true, force: true });
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const plugins = [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
jsxLocPlugin(),
|
||||
vitePluginManusRuntime(),
|
||||
vitePluginManusDebugCollector(),
|
||||
vitePluginExcludeManusFromDist(),
|
||||
];
|
||||
|
||||
export default defineConfig({
|
||||
plugins,
|
||||
base: process.env.NODE_ENV === 'production' ? '/x8/v2/public/' : '/',
|
||||
base: process.env.NODE_ENV === "production" ? "/x8/v2/" : "/",
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(import.meta.dirname, "client", "src"),
|
||||
@@ -169,7 +191,7 @@ export default defineConfig({
|
||||
build: {
|
||||
target: 'esnext',
|
||||
cssTarget: 'esnext',
|
||||
outDir: path.resolve(import.meta.dirname, "dist/public"),
|
||||
outDir: path.resolve(import.meta.dirname, "dist"),
|
||||
emptyOutDir: true,
|
||||
minify: 'terser',
|
||||
terserOptions: {
|
||||
|
||||
Reference in New Issue
Block a user