fix prod env

This commit is contained in:
Jeff Emmett 2024-12-07 13:43:56 -05:00
parent 614c1f2dcf
commit d6a5019b72
2 changed files with 30 additions and 43 deletions

View File

@ -27,10 +27,7 @@ import { useCameraControls } from '@/hooks/useCameraControls'
import { zoomToSelection } from '../ui-overrides' import { zoomToSelection } from '../ui-overrides'
// Default to production URL if env var isn't available // Default to production URL if env var isn't available
const DEFAULT_WORKER_URL = 'https://jeffemmett-canvas.jeffemmett.workers.dev'; export const 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;
const shapeUtils = [ChatBoxShape, VideoChatShape, EmbedShape] const shapeUtils = [ChatBoxShape, VideoChatShape, EmbedShape]
const tools = [ChatBoxTool, VideoChatTool, EmbedTool]; // Array of tools const tools = [ChatBoxTool, VideoChatTool, EmbedTool]; // Array of tools

View File

@ -5,44 +5,34 @@ import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await"; import topLevelAwait from "vite-plugin-top-level-await";
import { viteStaticCopy } from 'vite-plugin-static-copy'; import { viteStaticCopy } from 'vite-plugin-static-copy';
export default defineConfig(({ mode }) => { export default defineConfig({
// Load env file based on `mode` in the current working directory. envPrefix: ['VITE_'],
const env = loadEnv(mode, process.cwd(), ''); plugins: [
react(),
return { wasm(),
envPrefix: ['VITE_'], topLevelAwait(),
plugins: [ markdownPlugin,
react(), viteStaticCopy({
wasm(), targets: [
topLevelAwait(), {
markdownPlugin, src: 'src/posts/',
viteStaticCopy({ dest: '.'
targets: [ }
{ ]
src: 'src/posts/', })
dest: '.' ],
} server: {
] host: '0.0.0.0',
}) port: 5173,
], },
server: { build: {
host: '0.0.0.0', sourcemap: true,
port: 5173, },
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'
)
}
};
}); });