mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-17 22:27:19 +00:00
- Update capacitor.config.ts to support live reload via environment variables (CAPACITOR_LIVE_RELOAD and CAPACITOR_SERVER_URL) - Add script/capacitor-live-reload.ts to auto-detect local IP and configure sync - Add script/capacitor-production.ts to revert to production bundled assets - Add npm scripts: cap:live-reload, cap:production, dev:mobile - Update vite.config.ts to use appropriate HMR settings for local vs cloud dev https://claude.ai/code/session_01WzGEr7t8hWFyiANo22iokS
67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import path from "path";
|
|
import runtimeErrorOverlay from "@replit/vite-plugin-runtime-error-modal";
|
|
import { metaImagesPlugin } from "./vite-plugin-meta-images";
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
runtimeErrorOverlay(),
|
|
tailwindcss(),
|
|
metaImagesPlugin(),
|
|
...(process.env.NODE_ENV !== "production" &&
|
|
process.env.REPL_ID !== undefined
|
|
? [
|
|
await import("@replit/vite-plugin-cartographer").then((m) =>
|
|
m.cartographer(),
|
|
),
|
|
await import("@replit/vite-plugin-dev-banner").then((m) =>
|
|
m.devBanner(),
|
|
),
|
|
]
|
|
: []),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(import.meta.dirname, "client", "src"),
|
|
"@shared": path.resolve(import.meta.dirname, "shared"),
|
|
"@assets": path.resolve(import.meta.dirname, "attached_assets"),
|
|
},
|
|
},
|
|
css: {
|
|
postcss: {
|
|
plugins: [],
|
|
},
|
|
},
|
|
root: path.resolve(import.meta.dirname, "client"),
|
|
publicDir: path.resolve(import.meta.dirname, "client", "public"),
|
|
build: {
|
|
outDir: path.resolve(import.meta.dirname, "dist/public"),
|
|
emptyOutDir: true,
|
|
},
|
|
server: {
|
|
cors: true,
|
|
host: "0.0.0.0",
|
|
port: 5000,
|
|
// HMR configuration - use different settings for Capacitor live reload vs cloud dev
|
|
hmr: process.env.CAPACITOR_LIVE_RELOAD === 'true'
|
|
? {
|
|
// For Capacitor live reload: use default WebSocket on same host
|
|
protocol: 'ws',
|
|
host: undefined, // Uses request host automatically
|
|
}
|
|
: {
|
|
// For cloud development (GitHub Codespaces, Replit, etc.)
|
|
host: "orange-journey-wvwxgw4r6vrf577-5000.app.github.dev",
|
|
protocol: "wss",
|
|
clientPort: 443,
|
|
},
|
|
allowedHosts: true,
|
|
fs: {
|
|
strict: true,
|
|
deny: ["**/.*"],
|
|
},
|
|
},
|
|
});
|