weegee
weegee8mo ago

Deno dependency top level await work around

I have the following error while building with dnt
[dnt] Top level await cannot be used when distributing CommonJS/UMD (See deps/deno.land/x/sqlite@v3.2.1/mod.ts 16:1). Please re-organize your code to not use a top level await or only distribute an ES module by setting the 'scriptModule' build option to false.
[dnt] Top level await cannot be used when distributing CommonJS/UMD (See deps/deno.land/x/sqlite@v3.2.1/mod.ts 16:1). Please re-organize your code to not use a top level await or only distribute an ES module by setting the 'scriptModule' build option to false.
I cannot use top level await even with scriptModule: false, how do I workaround my dependency using it?
2 Replies
Danielduel
Danielduel8mo ago
Move your top level await to an async function and call it on start.
weegee
weegee8mo ago
its not me who's doing it, its a dependency @Danielduel