fix VITE_ worker URL
This commit is contained in:
parent
4bb6a9f72e
commit
de3ca11f5b
|
|
@ -26,8 +26,11 @@ import { components, uiOverrides } from '@/ui-overrides'
|
||||||
import { useCameraControls } from '@/hooks/useCameraControls'
|
import { useCameraControls } from '@/hooks/useCameraControls'
|
||||||
import { zoomToSelection } from '../ui-overrides'
|
import { zoomToSelection } from '../ui-overrides'
|
||||||
|
|
||||||
//const WORKER_URL = `https://jeffemmett-canvas.jeffemmett.workers.dev`
|
// Default to production URL if env var isn't available
|
||||||
export const WORKER_URL = import.meta.env.VITE_TLDRAW_WORKER_URL || 'https://jeffemmett-canvas.jeffemmett.workers.dev';
|
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 shapeUtils = [ChatBoxShape, VideoChatShape, EmbedShape]
|
||||||
const tools = [ChatBoxTool, VideoChatTool, EmbedTool]; // Array of tools
|
const tools = [ChatBoxTool, VideoChatTool, EmbedTool]; // Array of tools
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,48 @@
|
||||||
import { markdownPlugin } from './build/markdownPlugin';
|
import { markdownPlugin } from './build/markdownPlugin';
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig, loadEnv } from 'vite'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import wasm from "vite-plugin-wasm";
|
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({
|
export default defineConfig(({ mode }) => {
|
||||||
envPrefix: ['VITE_'],
|
// Load env file based on `mode` in the current working directory.
|
||||||
plugins: [
|
const env = loadEnv(mode, process.cwd(), '');
|
||||||
react(),
|
|
||||||
wasm(),
|
return {
|
||||||
topLevelAwait(),
|
envPrefix: ['VITE_'],
|
||||||
markdownPlugin,
|
plugins: [
|
||||||
viteStaticCopy({
|
react(),
|
||||||
targets: [
|
wasm(),
|
||||||
{
|
topLevelAwait(),
|
||||||
src: 'src/posts/',
|
markdownPlugin,
|
||||||
dest: '.'
|
viteStaticCopy({
|
||||||
}
|
targets: [
|
||||||
]
|
{
|
||||||
})
|
src: 'src/posts/',
|
||||||
],
|
dest: '.'
|
||||||
server: {
|
}
|
||||||
host: '0.0.0.0',
|
]
|
||||||
port: 5173,
|
})
|
||||||
},
|
],
|
||||||
build: {
|
server: {
|
||||||
sourcemap: true,
|
host: '0.0.0.0',
|
||||||
},
|
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'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue