Skip to content

Instantly share code, notes, and snippets.

@danieldietrich danieldietrich/index.js
Last active Nov 15, 2018

Embed
What would you like to do?
Node require
const f = require('./module.js');
const g = require('./module.js');
console.log("f()", f()); // = f() 0
console.log("g()", g()); // = g() 1
const path = require('path');
delete require.cache[path.resolve(__dirname, 'module.js')];
const h = require('./module.js');
console.log("h()", h()); // = h() 0
let i = 0;
module.exports = function() {
return i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.