Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

require.resolve() fails with an empty options object #28077

Copy link
Copy link
@75lb

Description

@75lb
Issue body actions
  • Version: v12.4.0
  • Platform: macOS 10.14.5
  • Subsystem: module

In an empty directory, install lodash then from the REPL run the following commands. The second command fails if you pass an empty options object.

> require.resolve('lodash')
'/Users/lloyd/Documents/tmp/require-resolve/node_modules/lodash/lodash.js'

> require.resolve('lodash', {})
Thrown:
Error: Cannot find module 'lodash'
Require stack:
- <repl>
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)
    at Function.resolve (internal/modules/cjs/helpers.js:21:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '<repl>' ]
}

If the options value is {} or { paths: undefined } I would expect it to be ignored and the built-in defaults used.

This issue breaks a few of my apps in node >= 12.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.