#Using esm format

11 messages · Page 1 of 1 (latest)

stable arch
#

How do I use the esm format in in here

const commands = [];
// Grab all the command files from the commands directory you created earlier
const commandFiles = readdirSync('./commands').filter(file => file.endsWith('.js'));

// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    commands.push(command.data.toJSON());
}

(it is the defult deploy-commands.js)

dapper yew
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

sly crane
#

Use dynamic import

#

await import()

stable arch
quiet summit
#

did you add some code into that file that you shouldn't?

stable arch
quiet summit
#

unless you made it to, no, since it would have no data to even pass to those commands

stable arch
#

I have one command file
removing it fixed the problem

quiet summit
#

and even then, those would either error (and quit) or just quit

stable arch
#

I also changed the defualt deploy-commands.js a bit to make it support the esm thing