Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m18s
CI/CD Pipeline / Security Scanning (push) Successful in 2m53s
CI/CD Pipeline / Lint and Format (push) Failing after 49s
CI/CD Pipeline / Terraform Validation (push) Failing after 24s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 26s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 42s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 39s
Validation / validate-genesis (push) Successful in 33s
Validation / validate-terraform (push) Failing after 28s
Validation / validate-kubernetes (push) Failing after 12s
Validation / validate-smart-contracts (push) Failing after 13s
Validation / validate-security (push) Failing after 1m21s
Validation / validate-documentation (push) Failing after 22s
Verify Deployment / Verify Deployment (push) Failing after 1m0s
83 lines
2.6 KiB
TypeScript
83 lines
2.6 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'path'
|
|
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react(),
|
|
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,
|
|
},
|
|
})
|