From 97b00c1569cf765c20e6b322efeb3f6ec5e7c246 Mon Sep 17 00:00:00 2001 From: Jeff Emmett <46964190+Jeff-Emmett@users.noreply.github.com> Date: Sat, 7 Dec 2024 13:43:56 -0500 Subject: [PATCH] fix prod env --- src/components/Board.tsx | 5 +-- vite.config.ts | 68 +++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 43 deletions(-) diff --git a/src/components/Board.tsx b/src/components/Board.tsx index c4d22c7..669f970 100644 --- a/src/components/Board.tsx +++ b/src/components/Board.tsx @@ -27,10 +27,7 @@ import { useCameraControls } from '@/hooks/useCameraControls' import { zoomToSelection } from '../ui-overrides' // Default to production URL if env var isn't available -const DEFAULT_WORKER_URL = 'https://jeffemmett-canvas.jeffemmett.workers.dev'; -export const WORKER_URL = typeof import.meta.env.VITE_TLDRAW_WORKER_URL === 'string' - ? import.meta.env.VITE_TLDRAW_WORKER_URL - : DEFAULT_WORKER_URL; +export const 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 7aba30b..81c5b98 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,44 +5,34 @@ import wasm from "vite-plugin-wasm"; import topLevelAwait from "vite-plugin-top-level-await"; import { viteStaticCopy } from 'vite-plugin-static-copy'; -export default defineConfig(({ mode }) => { - // Load env file based on `mode` in the current working directory. - const env = loadEnv(mode, process.cwd(), ''); - - return { - envPrefix: ['VITE_'], - plugins: [ - react(), - wasm(), - topLevelAwait(), - markdownPlugin, - viteStaticCopy({ - targets: [ - { - src: 'src/posts/', - dest: '.' - } - ] - }) - ], - server: { - host: '0.0.0.0', - port: 5173, +export default defineConfig({ + envPrefix: ['VITE_'], + plugins: [ + react(), + wasm(), + topLevelAwait(), + markdownPlugin, + viteStaticCopy({ + targets: [ + { + src: 'src/posts/', + dest: '.' + } + ] + }) + ], + server: { + host: '0.0.0.0', + port: 5173, + }, + build: { + sourcemap: true, + }, + base: '/', + publicDir: 'src/public', + resolve: { + alias: { + '@': '/src', }, - build: { - sourcemap: true, - }, - base: '/', - publicDir: 'src/public', - resolve: { - alias: { - '@': '/src', - }, - }, - define: { - 'import.meta.env.VITE_TLDRAW_WORKER_URL': JSON.stringify( - env.VITE_TLDRAW_WORKER_URL || 'https://jeffemmett-canvas.jeffemmett.workers.dev' - ) - } - }; + } });