Files
Netcatty/vite.config.ts
T
LAPTOP-O016UC3M\Qi Chen b03042d4f4 Add Google Drive sync via main process to fix CORS
Implements Google Drive sync operations (find, create, update, download, delete) via the Electron main process to work around CORS and COEP restrictions in the renderer. Updates the preload bridge and type definitions to expose new API methods, and adapts the sync logic to prefer main process proxies when available. Improves error handling and ensures prompt UI updates on disconnect.

Enables more reliable Google Drive cloud sync across platforms.
2025-12-15 16:35:40 +08:00

41 lines
1.2 KiB
TypeScript
Executable File

import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig } from 'vite';
export default defineConfig(() => {
return {
base: "./",
server: {
port: 5173,
host: 'localhost',
headers: {
// Required for SharedArrayBuffer and WASM in some browsers
'Cross-Origin-Opener-Policy': 'same-origin',
// Use credentialless to allow loading cross-origin images (e.g. Google avatars)
// while still enabling crossOriginIsolated.
'Cross-Origin-Embedder-Policy': 'credentialless',
},
},
build: {
chunkSizeWarningLimit: 3000,
target: 'esnext', // Required for top-level await in WASM modules
rollupOptions: {
output: {
// Disable code splitting for Electron compatibility with file:// protocol
manualChunks: undefined,
},
},
},
plugins: [tailwindcss(), react()],
optimizeDeps: {
exclude: ['ghostty-web'], // Don't pre-bundle ghostty-web to preserve WASM imports
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.'),
}
}
};
});