moublini
moublini3y ago

Dynamically imported module evaluation is still pending

I'm very confused on the error i put as the title because in my program i'm trying to just import some files in a directory and i get this really not self explainatory error, does somebody know anything? Thanks 😁 Code:
const comuneEventDir = path.resolve(__dirname, './events');
const eventDir = Deno.readDirSync(comuneEventDir);
for (const file of eventDir) {

if (!file.name.match(/^.*\.ts$/)) continue;
console.log(`importing ${comuneEventDir}/${file.name}...`)
await import(`${comuneEventDir}/${file.name}`);

}
const comuneEventDir = path.resolve(__dirname, './events');
const eventDir = Deno.readDirSync(comuneEventDir);
for (const file of eventDir) {

if (!file.name.match(/^.*\.ts$/)) continue;
console.log(`importing ${comuneEventDir}/${file.name}...`)
await import(`${comuneEventDir}/${file.name}`);

}
5 Replies
Andreu Botella (they/them)
If this code is inside an async function, make sure it's being called with await
moublini
moubliniOP3y ago
this loop is in the top level of the file
Andreu Botella (they/them)
And that if those calls are in other async functions, that those are also called with await, and so on Oh
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
moublini
moubliniOP3y ago
deno run

Did you find this page helpful?