Files
smom-dbis-138/frontend-dapp/vite.config.ts
zaragoza444 61de708a4c
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m19s
CI/CD Pipeline / Security Scanning (push) Successful in 2m40s
CI/CD Pipeline / Lint and Format (push) Failing after 45s
CI/CD Pipeline / Terraform Validation (push) Failing after 23s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 24s
Validation / validate-genesis (push) Successful in 27s
Validation / validate-terraform (push) Failing after 27s
Validation / validate-kubernetes (push) Failing after 10s
Validation / validate-smart-contracts (push) Failing after 10s
Validation / validate-security (push) Failing after 1m20s
Validation / validate-documentation (push) Failing after 19s
Verify Deployment / Verify Deployment (push) Failing after 1m20s
fix(frontend): Z Ecosystem UI — nav, branding, and Online Bank polish
Z mobile bottom nav, purple theme, correct boot splash/title on build:z,
Z-only routes in Online Bank, shared settlement state, liquidity panel,
and treasury branding without OMNL dead links.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 09:03:55 -07:00

104 lines
3.3 KiB
TypeScript

import { defineConfig, loadEnv, type Plugin } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
function ecosystemHtmlPlugin(isZ: boolean): Plugin {
return {
name: 'ecosystem-html',
transformIndexHtml(html) {
if (!isZ) return html
return html
.replace('<title>DBIS — Chain 138</title>', '<title>Z Blockchain System</title>')
.replace('content="#141a16"', 'content="#1a1624"')
.replace(/background: #141a16/g, 'background: #1a1624')
.replace('class="omnl-boot__title">DBIS</div>', 'class="omnl-boot__title">Z</div>')
.replace('class="omnl-boot__hint">Loading…</div>', 'class="omnl-boot__hint">Loading Z Ecosystem…</div>')
},
}
}
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const isZ = env.VITE_ECOSYSTEM === 'z'
return {
plugins: [
react(),
ecosystemHtmlPlugin(isZ),
nodePolyfills({
// Enable polyfills for specific modules
globals: {
Buffer: true,
global: true,
process: true,
},
// Include specific polyfills
include: ['buffer', 'events', 'stream', 'util', 'crypto', 'vm'],
// Exclude Node.js built-ins that shouldn't be polyfilled
exclude: ['https', 'http', 'url', 'path', 'fs', 'os', 'net', 'tls', 'zlib'],
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
// Dedupe to avoid "multiple instances" warnings from transitive deps (e.g. @emotion/react, Lit)
dedupe: [
'react',
'react-dom',
'@emotion/react',
'@emotion/styled',
'lit',
'lit-html',
'lit-element',
],
},
server: {
port: 3002,
proxy: {
'/api': { target: 'http://localhost:3000', changeOrigin: true },
'/settlement': { target: 'https://secure.omdnl.org', changeOrigin: true },
'/exchange': { target: 'https://exchange.omdnl.org', changeOrigin: true },
'/omnl': {
target: 'http://localhost:3000',
changeOrigin: true,
bypass(req) {
const url = req.url ?? '';
if (/^\/omnl\/(compliance|dashboard|terminal)\/?(\?.*)?$/.test(url)) return url;
if (url.startsWith('/omnl/static/')) return url;
},
},
'/reserve': { target: 'http://localhost:3000', changeOrigin: true },
},
},
optimizeDeps: {
// Exclude problematic packages from optimization
exclude: ['https', 'http', 'url', 'stream', 'util', 'crypto', 'path', 'fs', 'os', 'net', 'tls', 'zlib'],
include: ['@safe-global/protocol-kit'],
},
define: {
global: 'globalThis',
'process.env': {},
},
build: {
rollupOptions: {
output: {
// Add Content Security Policy meta tag via HTML plugin if needed
},
external: (id) => {
// Do NOT externalise crypto, buffer, stream, util, events - vite-plugin-node-polyfills provides them for the browser.
// Externalise only Node built-ins we don't polyfill (bundling would fail or break in browser).
const nodeBuiltIns = ['path', 'fs', 'os', 'net', 'tls', 'zlib', 'https', 'http', 'url']
return nodeBuiltIns.includes(id)
},
},
commonjsOptions: {
transformMixedEsModules: true,
},
chunkSizeWarningLimit: 1000,
},
}
})