First Example from the site doesn't work.

The very first example to work with and get an idea of tells me "Cannot use import statement outside a module" Do we have to use const? Using 14.14.1 discordjs and Node 18.17.1
3 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
duck
duck7mo ago
not really sure what example you're looking at that uses esm style imports given that the guide's examples use cjs but regardless, you'll likely want to brush up on the basics before learning to make a bot if you're unsure about the syntax for importing things
Estal
Estal7mo ago
Fair enough. Was looking at the docs from 14.14.1; it's been a few years since I messed around with js really, but just changing the extension to mjs from js has helped