#Dynamically imported module evaluation is still pending

8 messages · Page 1 of 1 (latest)

loud gulch
#

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}`);
    
}```
civic hearth
#

If this code is inside an async function, make sure it's being called with await

loud gulch
#

this loop is in the top level of the file

civic hearth
#

And that if those calls are in other async functions, that those are also called with await, and so on

#

Oh

tight kelp
#

do you run with deno run or are you using deno compile?

drifting garnet
#

If using deno compile it would tell you that you can't dynamically import files

tight kelp