vite-plugin-top-level-await
vite-plugin-top-level-await copied to clipboard
Here is something wrong with 【npm/yarn/pnpn】 run 【dev/build】
This is My packjson "vite-plugin-top-level-await": "^1.4.1", And this is my vite.config.ts
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import topLevelAwait from 'vite-plugin-top-level-await'
import path from 'path'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, __dirname)
return {
define: {
'process.env': env,
},
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => ['swiper-slide', 'swiper-container'].includes(tag),
},
},
reactivityTransform: true,
}),
vueJsx(),
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}`,
}),
],
base: '/zwr/portal/',
// logLevel: 'error',
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
port: 3000,
proxy: {
.....
},
},
css: {
preprocessorOptions: {
less: {
modifyVars: {
hack: `true; @import (reference) "${path.resolve('src/style/index.less')}";`,
},
javascriptEnabled: true,
},
},
},
}
})
But Yesterday ,everythings is ok,And the node_modules has this file。
What can I do for this? Thank you and Best wish~!