waku-lab/examples/buddybook/vite.config.ts

59 lines
1.5 KiB
TypeScript
Raw Normal View History

2024-10-25 00:11:04 +00:00
import path from "path"
import react from "@vitejs/plugin-react"
import { defineConfig, loadEnv } from "vite"
2024-10-25 00:11:04 +00:00
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
2024-11-08 03:40:26 +00:00
base: '/',
plugins: [
react(),
{
name: 'html-transform',
transformIndexHtml(html) {
return html.replace(
/%VITE_WALLETCONNECT_PROJECT_ID%/g,
env.VITE_WALLETCONNECT_PROJECT_ID || ''
)
}
}
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
stream: 'stream-browserify',
buffer: 'buffer',
util: 'util',
process: 'process/browser',
},
2024-10-25 00:11:04 +00:00
},
build: {
assetsDir: 'assets',
manifest: true,
rollupOptions: {
output: {
entryFileNames: 'assets/[name]-[hash].js',
chunkFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash].[ext]'
}
2024-10-29 10:50:46 +00:00
}
},
define: {
global: 'globalThis',
'process.env.VITE_WALLETCONNECT_PROJECT_ID': JSON.stringify(env.VITE_WALLETCONNECT_PROJECT_ID),
'process': {
'env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'DEBUG': JSON.stringify(process.env.DEBUG),
'VITE_WALLETCONNECT_PROJECT_ID': JSON.stringify(env.VITE_WALLETCONNECT_PROJECT_ID)
},
'nextTick': 'setImmediate',
'platform': JSON.stringify('browser'),
'version': JSON.stringify('v16.0.0'),
'browser': true
},
2024-10-29 10:50:46 +00:00
}
}
2024-10-25 00:11:04 +00:00
})