I have my index.js file, where I have required my config.json file like this:
const config = require("../config.json");
config.json is just json file. Then I have imported my custom class like this:
let myClass = require('./myClass.js');
If I then need access to my config in myClass.js and put there same require like in my index.js, it gives me error:
Cannot redeclare block-scoped variable 'config'.
But if I don't place there that require, then on NodeJS running, it gives me error:
config is not defined
So, how can I use my config.json (or any package) with require, without renaming it in every file?
Thanks!