import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { fileURLToPath } from 'node:url'; const sharedSrc = fileURLToPath(new URL('../shared/src/index.ts', import.meta.url)); export default defineConfig({ plugins: [react()], resolve: { // Point at the source so editing shared types hot-reloads the app instead // of requiring a rebuild of the shared package first. alias: { '@wellformed/shared': sharedSrc }, }, server: { port: 5173, strictPort: true, proxy: { '/api': { target: 'http://127.0.0.1:4000', changeOrigin: false, }, }, }, build: { outDir: 'dist', sourcemap: true, target: 'es2022', }, // The SSR entry bundles every dependency (React included), so the API // server can import the one emitted file without a node_modules of its own. ssr: { noExternal: true, }, });