fix VITE_ worker URL
This commit is contained in:
parent
0eb4407219
commit
6f6c924f66
|
|
@ -26,8 +26,11 @@ import { components, uiOverrides } from '@/ui-overrides'
|
|||
import { useCameraControls } from '@/hooks/useCameraControls'
|
||||
import { zoomToSelection } from '../ui-overrides'
|
||||
|
||||
//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';
|
||||
// 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;
|
||||
|
||||
const shapeUtils = [ChatBoxShape, VideoChatShape, EmbedShape]
|
||||
const tools = [ChatBoxTool, VideoChatTool, EmbedTool]; // Array of tools
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import { markdownPlugin } from './build/markdownPlugin';
|
||||
import { defineConfig } from 'vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import wasm from "vite-plugin-wasm";
|
||||
import topLevelAwait from "vite-plugin-top-level-await";
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
|
||||
export default defineConfig({
|
||||
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(),
|
||||
|
|
@ -35,4 +39,10 @@ export default defineConfig({
|
|||
'@': '/src',
|
||||
},
|
||||
},
|
||||
})
|
||||
define: {
|
||||
'import.meta.env.VITE_TLDRAW_WORKER_URL': JSON.stringify(
|
||||
env.VITE_TLDRAW_WORKER_URL || 'https://jeffemmett-canvas.jeffemmett.workers.dev'
|
||||
)
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue