Skip to content

relative module paths resolve differently in REPL. #5684

Description

@jdalton
  • 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.js

In 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

touch foo.js

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'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.pathIssues and PRs related to the path subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions