import { fileURLToPath } from 'node:url'; import path from 'node:path'; import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; const rootDir = path.dirname(fileURLToPath(import.meta.url)); const engineDir = path.resolve(rootDir, '../engine'); 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], }, }, });