From 6ab5b287500a6f8fda8ab411b5932f0955d1b2de Mon Sep 17 00:00:00 2001 From: Beeno Tung Date: Sun, 19 May 2024 15:07:12 -0700 Subject: [PATCH] patch: fix build error "[vite-plugin-top-level-await] Bindings not found." --- frontend/vite.config.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 24b2b54..d3a84b4 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -3,7 +3,6 @@ import { dependencies } from './package.json'; import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { visualizer } from 'rollup-plugin-visualizer'; -import topLevelAwait from 'vite-plugin-top-level-await'; // dependencies that exist anywhere const vendor = [ @@ -37,6 +36,11 @@ function renderChunks(deps: Record) { // https://vitejs.dev/config/ export default defineConfig({ + esbuild: { + supported: { + 'top-level-await': true //browsers can handle top-level-await features + }, + }, plugins: [ react(), visualizer({ @@ -44,12 +48,9 @@ export default defineConfig({ gzipSize: true, brotliSize: true }), - topLevelAwait({ - promiseExportName: '__tla', - promiseImportName: i => `__tla_${i}` - }) ], build: { + target: 'esnext', chunkSizeWarningLimit: 3000, rollupOptions: { output: {