1import { fileURLToPath } from "node:url";2import { jazzPlugin } from "jazz-tools/dev/vite";3import { defineConfig } from "vite";45const workspaceRoot = fileURLToPath(new URL("../../", import.meta.url));6const cloudAppId = process.env.JAZZ_APP_ID?.trim();7const cloudServerUrl = process.env.JAZZ_SERVER_URL?.trim();89if (Boolean(cloudAppId) !== Boolean(cloudServerUrl)) {10 throw new Error(11 "Cloud mode requires both JAZZ_APP_ID and JAZZ_SERVER_URL; set the missing name or remove the partial pair.",12 );13}1415// Only the public pair is projected into Vite's client namespace. Jazz's16// server credentials remain unprefixed for schema publication by the plugin.17if (cloudAppId && cloudServerUrl) {18 process.env.VITE_JAZZ_APP_ID = cloudAppId;19 process.env.VITE_JAZZ_SERVER_URL = cloudServerUrl;20}2122export default defineConfig({23 plugins: [24 jazzPlugin({25 schemaDir: import.meta.dirname,26 inspector: false,27 server: {28 allowLocalFirstAuth: true,29 },30 }),31 ],32 build: {33 outDir: "dist",34 emptyOutDir: true,35 },36 server: {37 // Deno places npm packages under the workspace's hidden node_modules/.deno38 // tree. Jazz resolves its WASM to that absolute path, so Vite must allow39 // the workspace root rather than only this nested spike root.40 fs: {41 allow: [workspaceRoot],42 },43 },44});