64 lines
2.0 KiB
TypeScript
Executable File
64 lines
2.0 KiB
TypeScript
Executable File
import { defineConfig } from 'vite';
|
|
import wasm from 'vite-plugin-wasm';
|
|
import { fileURLToPath, URL } from 'node:url';
|
|
|
|
export default defineConfig({
|
|
// Configuration du serveur de développement
|
|
server: {
|
|
port: 3003,
|
|
host: '0.0.0.0', // Permet l'accès depuis l'extérieur (Docker/Réseau)
|
|
allowedHosts: ['dev2.4nkweb.com'],
|
|
proxy: {
|
|
// Proxy pour le stockage
|
|
'/storage': {
|
|
target: process.env.VITE_STORAGEURL || 'https://dev2.4nkweb.com',
|
|
changeOrigin: true,
|
|
secure: false, // Accepte les certificats auto-signés si besoin
|
|
rewrite: (path) => path.replace(/^\/storage/, '/storage'),
|
|
},
|
|
// Proxy pour les websockets (si besoin de contourner CORS ou SSL)
|
|
'/ws': {
|
|
target: process.env.VITE_BOOTSTRAPURL?.replace('ws', 'http') || 'https://dev2.4nkweb.com',
|
|
ws: true,
|
|
changeOrigin: true,
|
|
secure: false,
|
|
},
|
|
// Proxy pour l'API BlindBit
|
|
'/blindbit': {
|
|
target: process.env.VITE_BLINDBITURL || 'https://dev2.4nkweb.com/blindbit',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/blindbit/, ''),
|
|
},
|
|
},
|
|
},
|
|
|
|
// Plugins essentiels
|
|
plugins: [
|
|
wasm(), // Indispensable pour ton SDK Rust
|
|
],
|
|
|
|
// Alias pour les imports (ex: import ... from '@/services/...')
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
'~': fileURLToPath(new URL('./src', import.meta.url)), // Rétro-compatibilité avec tes anciens imports
|
|
},
|
|
},
|
|
|
|
// Configuration du Build
|
|
build: {
|
|
target: 'esnext', // Nécessaire pour le "Top Level Await" souvent utilisé avec WASM
|
|
outDir: 'dist',
|
|
assetsDir: 'assets',
|
|
emptyOutDir: true, // Vide le dossier dist avant chaque build
|
|
// On retire la config "lib" car c'est maintenant une App autonome
|
|
},
|
|
|
|
// Configuration spécifique pour les Workers (Database)
|
|
worker: {
|
|
format: 'es',
|
|
plugins: () => [wasm()],
|
|
},
|
|
});
|