SyntaxError: Unexpected token 'export'

const Discord = require("discord.js")

const buttonCommand = new Discord.SlashCommandBuilder()
.setName("channels")
.setDescription("channels cmd")

export default buttonCommand.toJSON();
const Discord = require("discord.js")

const buttonCommand = new Discord.SlashCommandBuilder()
.setName("channels")
.setDescription("channels cmd")

export default buttonCommand.toJSON();
3 Replies
d.js toolkit
d.js toolkit14mo 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!
! MYA
! MYAOP14mo ago
it results in an error and import { SlashCommandBuilder } from "@discordjs/buiders" didnt work and also threw and error saying cannot use import outside of a module
treble/luna
treble/luna14mo ago
thats not djs related, you're probably trying to use ts in a js file
Want results from more Discord servers?
Add your server