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
module.exports = { lista }in the second file and import it in the first file usingrequire("queue.js"), if you get an import error, swap outqueue.jswith it's relative pathmodule.exports = { lista }should be added above the existing one? and once i addrequire("queue.js")to the first file, doingconsole.log(lista)would show the contents of lista on the console?listais the object that you want to export, yes.