Top-level|Top-level await is not available in the configured target...

Vite2打包报 Top-level await is not available in the configured target environment
直接上方案
【Top-level|Top-level await is not available in the configured target...】在vite.config.ts的加上下面
build: {
target: "es2019",
}
或者
build: {
target: "esnext",
}
或者
build: {
target: ['edge90','chrome90','firefox90','safari15','esnext'],
}

    推荐阅读