mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-08-28 05:25:25 +00:00
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import wasm from 'vite-plugin-wasm';
|
|
import topLevelAwait from 'vite-plugin-top-level-await';
|
|
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
|
import path from 'path';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
tailwindcss(),
|
|
wasm(),
|
|
topLevelAwait(),
|
|
// Copy kuzu-wasm worker file to assets folder for production
|
|
viteStaticCopy({
|
|
targets: [
|
|
{
|
|
src: 'node_modules/kuzu-wasm/kuzu_wasm_worker.js',
|
|
dest: 'assets'
|
|
}
|
|
]
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
// Polyfill Buffer for isomorphic-git (Node.js API needed in browser)
|
|
define: {
|
|
global: 'globalThis',
|
|
},
|
|
// Optimize deps - exclude kuzu-wasm from pre-bundling (it has WASM files)
|
|
optimizeDeps: {
|
|
exclude: ['kuzu-wasm'],
|
|
include: ['buffer'],
|
|
},
|
|
// Required for KuzuDB WASM (SharedArrayBuffer needs Cross-Origin Isolation)
|
|
server: {
|
|
headers: {
|
|
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
'Cross-Origin-Embedder-Policy': 'require-corp',
|
|
},
|
|
// Allow serving files from node_modules
|
|
fs: {
|
|
allow: ['..'],
|
|
},
|
|
},
|
|
// Also set for preview/production builds
|
|
preview: {
|
|
headers: {
|
|
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
'Cross-Origin-Embedder-Policy': 'require-corp',
|
|
},
|
|
},
|
|
// Worker configuration
|
|
worker: {
|
|
format: 'es',
|
|
plugins: () => [wasm(), topLevelAwait()],
|
|
},
|
|
});
|