diff --git a/src/components/Board.tsx b/src/components/Board.tsx index bd1334e..463d3c3 100644 --- a/src/components/Board.tsx +++ b/src/components/Board.tsx @@ -26,7 +26,14 @@ import { components, uiOverrides } from '@/ui-overrides' import { useCameraControls } from '@/hooks/useCameraControls' //const WORKER_URL = `https://jeffemmett-canvas.jeffemmett.workers.dev` -export const WORKER_URL = import.meta.env.VITE_TLDRAW_WORKER_URL || 'https://jeffemmett-canvas.jeffemmett.workers.dev'; +export const WORKER_URL = (() => { + // During development + if (import.meta.env.DEV) { + return 'http://127.0.0.1:5172'; + } + // In production + return import.meta.env.VITE_TLDRAW_WORKER_URL || 'https://jeffemmett-canvas.jeffemmett.workers.dev'; +})(); const shapeUtils = [ChatBoxShape, VideoChatShape, EmbedShape] const tools = [ChatBoxTool, VideoChatTool, EmbedTool]; // Array of tools diff --git a/vite.config.ts b/vite.config.ts index 08c847e..9ded5e1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,8 +7,7 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'; export default defineConfig({ define: { - // Remove this since we're using VITE_ prefix - // 'process.env.TLDRAW_WORKER_URL': JSON.stringify(process.env.TLDRAW_WORKER_URL) + 'import.meta.env.VITE_TLDRAW_WORKER_URL': JSON.stringify(process.env.VITE_TLDRAW_WORKER_URL || 'https://jeffemmett-canvas.jeffemmett.workers.dev') }, envPrefix: ['VITE_'], plugins: [