Having such a simple module (exports.js):
module.exports.val1 = "boz";
exports.val2 = "bar";
module.exports.fun1 = function Something() {
console.log("bla bla");
};
exports.fun2 = function Something() {
console.log("bla bla");
};
exports = "abc"; //1
module = "def" //2
console.log(module);
console.log(exports);
and the file importing it(index.js):
var imp = require("./exports")
console.log(imp)
i get on the output:
def
abc
{val1: "boz", val2: "bar", fun1: ƒ Something(), fun2: ƒ Something()}
How can the imports be accessible/defined in the index file since it's overwritten on the #1 & #2 in the module file itself (what can be observed getting this 2 strings from module logs)?