relative module paths resolve differently in REPL.
- Version: v5.5.0
- Platform: Darwin jdalton.local 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64
npm init
# <init a package>
npm i lodash --save
touch lodash.jsIn lodash.js
module.exports = { 'VERSION': 'should be me' };
Now in the REPL
console.log(require('./lodash').VERSION); // => 4.6.1 instead of 'should be me'
Put the same code in a file
In foo.js
console.log(require('./lodash').VERSION);
Then
node foo
# logs 'should be me'It would work in the REPL if I changed the path from './lodash' to './lodash.js'.