修复vite打包异常

This commit is contained in:
孟帅
2023-01-18 17:31:52 +08:00
parent 4348aeaa3b
commit 11fad0132d
3 changed files with 10 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
import type { Plugin } from 'vite';
import Components from 'unplugin-vue-components/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
import topLevelAwait from 'vite-plugin-top-level-await';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
@@ -23,6 +23,14 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean, prodMock)
dts: true,
resolvers: [NaiveUiResolver()],
}),
// 支持顶级wait
topLevelAwait({
// The export name of top-level await promise for each chunk module
promiseExportName: '__tla',
// The function to generate import names of top-level await promise in each chunk module
promiseImportName: (i) => `__tla_${i}`,
}),
];
// vite-plugin-html