fix: Add global Buffer polyfill to vite.config.ts

This commit is contained in:
LC mac
2026-02-08 01:38:08 +08:00
parent 54195ead8d
commit 489d3fea3b

View File

@@ -24,6 +24,18 @@ export default defineConfig({
}
}
],
resolve: {
alias: {
buffer: 'buffer',
}
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis'
}
}
},
base: '/', // Always use root, since we're Cloudflare Pages only
publicDir: 'public', // ← Explicitly set (should be default)
build: {
@@ -34,5 +46,6 @@ export default defineConfig({
'__APP_VERSION__': JSON.stringify(appVersion),
'__BUILD_HASH__': JSON.stringify(gitHash),
'__BUILD_TIMESTAMP__': JSON.stringify(new Date().toISOString()),
'global': 'globalThis',
}
})