64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import cesium from 'vite-plugin-cesium'
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), cesium()],
|
|
|
|
optimizeDeps: {
|
|
// Prevent Vite from pre-bundling Cesium — it ships its own worker scripts
|
|
// that must be loaded from a specific public path, not inlined.
|
|
exclude: ['cesium'],
|
|
// Force pre-bundling of @mkkellogg/gaussian-splats-3d and all its CJS
|
|
// transitive dependencies. The 'pkg > dep' syntax tells Vite's esbuild
|
|
// step to convert each dep to ESM when reached through that package.
|
|
// All CJS transitive dependencies of cesium and @mkkellogg/gaussian-splats-3d.
|
|
// Because cesium is in exclude, Vite won't crawl its deps automatically —
|
|
// every CJS package it touches must be listed here for ESM conversion.
|
|
// List generated via: node -e "..." (see vite.config.ts comments above)
|
|
include: [
|
|
'@mkkellogg/gaussian-splats-3d',
|
|
'@mkkellogg/gaussian-splats-3d > mersenne-twister',
|
|
'@mkkellogg/gaussian-splats-3d > urijs',
|
|
'autolinker',
|
|
'bitmap-sdf',
|
|
'dompurify',
|
|
'draco3d',
|
|
'grapheme-splitter',
|
|
'lerc',
|
|
'mersenne-twister',
|
|
'meshoptimizer',
|
|
'nosleep.js',
|
|
'pako',
|
|
'protobufjs',
|
|
'topojson-client',
|
|
'urijs',
|
|
],
|
|
},
|
|
|
|
build: {
|
|
chunkSizeWarningLimit: 4000,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
// cesium is handled by vite-plugin-cesium (served from /Cesium/ public path)
|
|
// and must NOT appear here.
|
|
splat: ['@mkkellogg/gaussian-splats-3d', 'three'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
// Proxy API calls to Django — avoids CORS in development.
|
|
// Django dev server runs on the host at :8000.
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
})
|