patch: fix build error "[vite-plugin-top-level-await] Bindings not found."
This commit is contained in:
parent
ef4b82a91d
commit
6ab5b28750
@ -3,7 +3,6 @@ import { dependencies } from './package.json';
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { visualizer } from 'rollup-plugin-visualizer';
|
import { visualizer } from 'rollup-plugin-visualizer';
|
||||||
import topLevelAwait from 'vite-plugin-top-level-await';
|
|
||||||
|
|
||||||
// dependencies that exist anywhere
|
// dependencies that exist anywhere
|
||||||
const vendor = [
|
const vendor = [
|
||||||
@ -37,6 +36,11 @@ function renderChunks(deps: Record<string, string>) {
|
|||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
esbuild: {
|
||||||
|
supported: {
|
||||||
|
'top-level-await': true //browsers can handle top-level-await features
|
||||||
|
},
|
||||||
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
visualizer({
|
visualizer({
|
||||||
@ -44,12 +48,9 @@ export default defineConfig({
|
|||||||
gzipSize: true,
|
gzipSize: true,
|
||||||
brotliSize: true
|
brotliSize: true
|
||||||
}),
|
}),
|
||||||
topLevelAwait({
|
|
||||||
promiseExportName: '__tla',
|
|
||||||
promiseImportName: i => `__tla_${i}`
|
|
||||||
})
|
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
|
target: 'esnext',
|
||||||
chunkSizeWarningLimit: 3000,
|
chunkSizeWarningLimit: 3000,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
|
Loading…
Reference in New Issue
Block a user