Answer the question
In order to leave comments, you need to log in
How to include another file using require?
There is a file settings.js
in it
const sel = {
user: 'Patron'
}
module.exports = sel
const { sel } = require('./settings')
console.log('user', sel)
sel -> undefined
Answer the question
In order to leave comments, you need to log in
replace:
module.exports = sel
with
exports.sel = sel;
// или
module.exports.sel = sel
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question