|
@@ -10,6 +10,7 @@ import UnoCSS from 'unocss/vite'
|
|
|
import VueMacros from 'unplugin-vue-macros/vite'
|
|
|
import { VantResolver } from 'unplugin-vue-components/resolvers'
|
|
|
import legacyPlugin from '@vitejs/plugin-legacy'
|
|
|
+import topLevelAwait from "vite-plugin-top-level-await";
|
|
|
|
|
|
import basicSsl from '@vitejs/plugin-basic-ssl'
|
|
|
export default defineConfig({
|
|
@@ -26,6 +27,13 @@ export default defineConfig({
|
|
|
},
|
|
|
plugins: [
|
|
|
basicSsl(),
|
|
|
+ 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}`
|
|
|
+ }),
|
|
|
+
|
|
|
legacyPlugin({
|
|
|
targets: ['chrome 52'], // 需要兼容的目标列表,可以设置多个
|
|
|
additionalLegacyPolyfills: ['regenerator-runtime/runtime'] // 面向IE11时需要此插件
|