31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { fileURLToPath } from 'node:url'
|
|
import path from 'node:path'
|
|
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
const rootDir = path.dirname(fileURLToPath(import.meta.url))
|
|
const engineDir = path.resolve(rootDir, '../engine')
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
// Follow the node_modules symlink to the real sibling directory, so Vite's dev server
|
|
// watches and transforms the actual engine source files (not a frozen pre-bundled copy).
|
|
preserveSymlinks: false,
|
|
},
|
|
optimizeDeps: {
|
|
// Treat @incgame/engine as first-party source, not a vendor dependency to pre-bundle once
|
|
// and cache — otherwise edits to the engine package wouldn't trigger HMR until a full
|
|
// dev-server restart.
|
|
exclude: ['@incgame/engine'],
|
|
},
|
|
server: {
|
|
fs: {
|
|
// The engine package lives outside this project's root (a sibling directory reached
|
|
// through a node_modules symlink); allow Vite to serve/watch files from there too.
|
|
allow: [rootDir, engineDir],
|
|
},
|
|
},
|
|
})
|