Loading a library twice
- Loads it only once but allows access to it from several names.
const say_hi = require('./lib2');
function other() {
const say_hello = require('./lib2');
say_hello('Bar');
}
console.log('Hello World');
say_hi('Foo');
other();
$ node examples/basic/app22.js
Loading module
Hello World
Hello Foo
Hello Bar