Published
- 1 min read
nodejs require everything without prefix
The solution for this is noted below
nodejs require everything without prefix
Solution
// file1.js
module.exports = { foo, bar, baz }
// file2.js
const { foo, bar, baz } = require('./file1')
foo()
baz()
Try other methods by searching on the site. That is if this doesn’t work