Skip to content

require() autocompletion in repl incorrectly removes file extensions from folders #14726

@not-an-aardvark

Description

@not-an-aardvark
  • Version: 8.3.0
  • Platform: macOS
  • Subsystem: repl

If a folder name ends in .js, the autocomplete suggestion in the repl will incorrectly remove the extension from the folder name.

To reproduce:

  1. mkdir foo_bar.js
  2. touch foo_bar.js/index.js
  3. node
  4. In the repl, enter require('./foo_ and press Tab

The autocomplete suggestion is require('./foo_bar') rather than require('./foo_bar.js'). Since foo_bar is a folder, removing the .js extension results in an error when calling require.

(I originally noticed this because I have a local clone of Inquirer.js, which was cloned into a folder with a .js extension.)

Metadata

Metadata

Labels

confirmed-bugIssues with confirmed bugs.replIssues and PRs related to the REPL subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions