cloudflare / cloudflare/worker-template-mysql
Top-level await is not available in the configured target
- Dominant language
- JavaScript
- Stars
- 60
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am facing following error when trying to publish it to cloudflare workers
```
✘ [ERROR] Top-level await is not available in the configured target environment ("es2020")
dist/index.mjs:8:1790:
8 │ ...)});let c=i.level||Ae,_=new Y(r,c,{handlers:s});T.loggers.set(r,_)}}await Qe(X);var dn=await async function(){return{LogLevels:f,Logger:Y,ha...
╵ ~~~~~
✘ [ERROR] Top-level await is not available in the configured target environment ("es2020")
dist/index.mjs:8:1809:
8 │ ...Ae,_=new Y(r,c,{handlers:s});T.loggers.set(r,_)}}await Qe(X);var dn=await async function(){return{LogLevels:f,Logger:Y,handlers:_n,LoggerCon...
╵ ~~~~~
✘ [ERROR] Build failed with 2 errors:
dist/index.mjs:8:1790: ERROR: Top-level await is not available in the configured target
environment ("es2020")
dist/index.mjs:8:1809: ERROR: Top-level await is not available in the configured target
environment ("es2020")
```
The problem seems to be arising from here:
```
await setup(DEFAULT_CONFIG);
const mod = await async function () {
return {
LogLevels: LogLevels,
Logger: Logger,
handlers: handlers1,
LoggerConfig: LoggerConfig,
getLogger: getLogger,
debug: debug,
info: info,
warning: warning,
error: error,
critical: critical,
setup: setup
};
}();
```
How do I enable `Top-level await` or how to make it work @nilslice ?
Contributor guide
Assessment
This issue has not been assessed yet.