mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
Handles WASM initialization and terminal opening errors to provide better diagnostics and reliability for the embedded terminal. Updates content security policy and dev server headers to support WASM and SharedArrayBuffer use, and optimizes build config for proper WASM module loading.
38 lines
1.1 KiB
TypeScript
Executable File
38 lines
1.1 KiB
TypeScript
Executable File
import tailwindcss from '@tailwindcss/vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
import { defineConfig,loadEnv } from 'vite';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, '.', '');
|
|
return {
|
|
base: "./",
|
|
server: {
|
|
port: 5173,
|
|
host: '0.0.0.0',
|
|
headers: {
|
|
// Required for SharedArrayBuffer and WASM in some browsers
|
|
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
'Cross-Origin-Embedder-Policy': 'require-corp',
|
|
},
|
|
},
|
|
build: {
|
|
chunkSizeWarningLimit: 1500,
|
|
target: 'esnext', // Required for top-level await in WASM modules
|
|
},
|
|
plugins: [tailwindcss(), react()],
|
|
optimizeDeps: {
|
|
exclude: ['ghostty-web'], // Don't pre-bundle ghostty-web to preserve WASM imports
|
|
},
|
|
define: {
|
|
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
|
|
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, '.'),
|
|
}
|
|
}
|
|
};
|
|
});
|