datewise/vite.config.ts
metatroncubeswdev e56182e0e3 chore: initial Datewise app (rebranded from SlotSure prototype)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 20:06:49 -04:00

28 lines
1.1 KiB
TypeScript

import { reactRouter } from "@react-router/dev/vite";
import { defineConfig, type UserConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
// Shopify CLI sets HOST/SHOPIFY_APP_URL; HMR goes through the tunnel when not on localhost.
if (process.env.HOST && (!process.env.SHOPIFY_APP_URL || process.env.SHOPIFY_APP_URL === process.env.HOST)) {
process.env.SHOPIFY_APP_URL = process.env.HOST;
delete process.env.HOST;
}
const host = new URL(process.env.SHOPIFY_APP_URL || "http://localhost").hostname;
const hmr =
host === "localhost"
? { protocol: "ws", host: "localhost", port: 64999, clientPort: 64999 }
: { protocol: "wss", host, port: parseInt(process.env.FRONTEND_PORT!) || 8002, clientPort: 443 };
export default defineConfig({
server: {
allowedHosts: [host],
cors: { preflightContinue: true },
port: Number(process.env.PORT || 3000),
hmr,
fs: { allow: ["app", "node_modules"] },
},
plugins: [reactRouter(), tsconfigPaths()],
build: { assetsInlineLimit: 0 },
optimizeDeps: { include: ["@shopify/app-bridge-react"] },
}) satisfies UserConfig;