Closed asasugar closed 2 years ago
This is not a Vite issue. Top level await is not supported in the default configured target. See on https://caniuse.com/?search=top%20level%20await. You should either change the target or use .then
to resolve the build.
Already Fix. set vite.config.ts
build.target
: 'esnext'
build: {
target: 'esnext'
}
For those who comes here from searching the error message, if you want to support normal browsers (without setting esnext
target), try my plugin vite-plugin-top-level-await.
Describe the bug
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
yarn dev is ok, yarn build is not work~~
Reproduction
https://github.com/asasugar/vite-element-plus-admin/blob/master/src/main.ts
System Info
Used Package Manager
yarn
Logs
Validations