OpChan/app/vite.config.ts

38 lines
1008 B
TypeScript
Raw Permalink Normal View History

2025-08-30 18:34:50 +05:30
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import path from 'path';
2025-04-15 16:28:03 +05:30
// https://vitejs.dev/config/
2025-09-01 16:59:40 +05:30
export default defineConfig(() => ({
2025-04-15 16:28:03 +05:30
server: {
2025-08-30 18:34:50 +05:30
host: '::',
2025-04-15 16:28:03 +05:30
port: 8080,
2025-10-23 13:56:25 +05:30
watch: {
// Watch source files in local packages for hot reload
ignored: ['!**/node_modules/@opchan/**'],
},
fs: {
// Allow serving files from the monorepo root
allow: ['..'],
},
2025-04-15 16:28:03 +05:30
},
2025-09-01 16:59:40 +05:30
plugins: [react()],
2025-04-15 16:28:03 +05:30
resolve: {
alias: {
2025-08-30 18:34:50 +05:30
'@': path.resolve(__dirname, './src'),
2025-09-18 10:15:06 +05:30
buffer: 'buffer',
2025-10-23 13:56:25 +05:30
// Point to source files instead of dist for hot reloading
'@opchan/core': path.resolve(__dirname, '../packages/core/src/index.ts'),
'@opchan/react': path.resolve(__dirname, '../packages/react/src/index.ts'),
2025-04-15 16:28:03 +05:30
},
},
2025-09-18 10:15:06 +05:30
optimizeDeps: {
2025-10-23 13:56:25 +05:30
include: ['buffer'],
// Exclude local packages from pre-bundling to enable hot reload
exclude: ['@opchan/core', '@opchan/react'],
2025-09-18 10:15:06 +05:30
},
build: {
target: 'es2022',
2025-08-30 18:34:50 +05:30
},
2025-04-15 16:28:03 +05:30
}));