69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
build: {
|
|
// The CAD viewer is route-lazy, but Three ships a monolithic ESM build.
|
|
// Keep the 3D stack split into cacheable vendor chunks and only relax
|
|
// the warning threshold enough to avoid a false positive on three-core.
|
|
chunkSizeWarningLimit: 750,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (!id.includes('node_modules')) return undefined
|
|
|
|
if (id.includes('three/build/three.module.js')) {
|
|
return 'three-core'
|
|
}
|
|
|
|
if (
|
|
id.includes('@react-three/fiber') ||
|
|
id.includes('react-reconciler') ||
|
|
id.includes('scheduler') ||
|
|
id.includes('its-fine') ||
|
|
id.includes('react-use-measure') ||
|
|
id.includes('suspend-react')
|
|
) {
|
|
return 'react-three-fiber'
|
|
}
|
|
|
|
if (
|
|
id.includes('@react-three/drei') ||
|
|
id.includes('three-stdlib') ||
|
|
id.includes('@monogrid/gainmap-js')
|
|
) {
|
|
return 'react-three-helpers'
|
|
}
|
|
|
|
return undefined
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: process.env.VITE_API_URL || 'http://localhost:8888',
|
|
changeOrigin: true,
|
|
ws: true,
|
|
},
|
|
'/thumbnails': {
|
|
target: process.env.VITE_API_URL || 'http://localhost:8888',
|
|
changeOrigin: true,
|
|
},
|
|
'/renders': {
|
|
target: process.env.VITE_API_URL || 'http://localhost:8888',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./src/__tests__/setup.ts'],
|
|
},
|
|
})
|