I have 2 files: bot.js and queue.js
In the second file i define a variable called queue using this code:
const { google } = require("googleapis");
const play = require('play-dl');
const lista = []
module.exports = { lista }
module.exports = {...
}
In the first file i try to import the object with this code:
require(`./commands/queue.js`)
console.log(lista)
But when And i would like to be able to use its content in the first file How can i do that? I've seen other answers and tried their methods but couldn't make it work
Ensure you export the object, then require it by deconstructing from the exports
Queue.js
const { google } = require("googleapis");
const play = require('play-dl');
const lista = []
module.exports = {
lista
}
Bot.js
const { lista } = require('path-to-queuejs-here');
console.log(lista)
// []