Motivations: - Fix 502 en prod via build multi-pages et routes stables - Stabilize IndexedDB (création stores) et faucet obligatoire - Déploiement robuste: port 3004 garanti et logs Modifications: - Vite: inputs multi-pages, alias npm deploy:front - Router/redirects: chemins - Pages setup: URLs corrigées, suppression log faucet disabled - DB: bump version à 5, upgrade crée stores manquants - Script: scripts/deploy_front.sh (kill 3004, clean, build, start bg) - Lint: perf monitor param non utilisé, warnings corrigés Page affectées: - vite.config.ts, src/router.ts - src/pages/* (home, pairing, block-sync, wallet-setup, security-setup) - src/services/* (database-config, performance-monitor) - package.json, scripts/deploy_front.sh
81 lines
2.5 KiB
TypeScript
Executable File
81 lines
2.5 KiB
TypeScript
Executable File
import { defineConfig } from 'vite';
|
|
import path from 'path';
|
|
// @ts-ignore - vite-plugin-wasm type definitions issue
|
|
import wasm from 'vite-plugin-wasm';
|
|
import topLevelAwait from 'vite-plugin-top-level-await';
|
|
|
|
export default defineConfig({
|
|
optimizeDeps: {
|
|
include: [],
|
|
// Exclude heavy dependencies from pre-bundling
|
|
exclude: ['pkg/sdk_client.js']
|
|
},
|
|
plugins: [
|
|
wasm(),
|
|
topLevelAwait()
|
|
],
|
|
build: {
|
|
outDir: 'dist',
|
|
target: 'esnext',
|
|
minify: true, // Enable minification to reduce size
|
|
rollupOptions: {
|
|
input: {
|
|
index: path.resolve(__dirname, 'index.html'),
|
|
'wallet-setup': path.resolve(__dirname, 'src/pages/wallet-setup/wallet-setup.html'),
|
|
'security-setup': path.resolve(__dirname, 'src/pages/security-setup/security-setup.html'),
|
|
'birthday-setup': path.resolve(__dirname, 'src/pages/birthday-setup/birthday-setup.html'),
|
|
'block-sync': path.resolve(__dirname, 'src/pages/block-sync/block-sync.html'),
|
|
'pairing': path.resolve(__dirname, 'src/pages/pairing/pairing.html'),
|
|
'home': path.resolve(__dirname, 'src/pages/home/home.html'),
|
|
'iframe-home': path.resolve(__dirname, 'src/pages/home/iframe-home.html'),
|
|
'account': path.resolve(__dirname, 'src/pages/account/account.html'),
|
|
'iframe-pairing': path.resolve(__dirname, 'src/pages/iframe-pairing.html'),
|
|
},
|
|
output: {
|
|
manualChunks: {
|
|
// Split WebAssembly into separate chunk
|
|
'wasm': ['pkg/sdk_client.js']
|
|
}
|
|
}
|
|
}
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': '/src',
|
|
},
|
|
extensions: ['.ts', '.tsx', '.js'],
|
|
},
|
|
server: {
|
|
fs: {
|
|
cachedChecks: false,
|
|
},
|
|
port: 3004,
|
|
host: '0.0.0.0',
|
|
allowedHosts: [
|
|
'dev3.4nkweb.com',
|
|
'localhost',
|
|
'127.0.0.1',
|
|
'31.33.24.235'
|
|
],
|
|
proxy: {
|
|
'/storage': {
|
|
target: 'https://dev3.4nkweb.com',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
rewrite: (path) => path.replace(/^\/storage/, '/storage'),
|
|
configure: (proxy, _options) => {
|
|
proxy.on('error', (err, _req, _res) => {
|
|
console.log('proxy error', err);
|
|
});
|
|
proxy.on('proxyReq', (_proxyReq, req, _res) => {
|
|
console.log('Sending Request:', req.method, req.url);
|
|
});
|
|
proxy.on('proxyRes', (proxyRes, req, _res) => {
|
|
console.log('Received Response:', proxyRes.statusCode, req.url);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
},
|
|
});
|