From 489d3fea3bcd17a8e9c74b1be4fe9e8ddc08cece Mon Sep 17 00:00:00 2001 From: LC mac Date: Sun, 8 Feb 2026 01:38:08 +0800 Subject: [PATCH] fix: Add global Buffer polyfill to vite.config.ts --- vite.config.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index fe7e507..7c90067 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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', } })