Skip to content

resolve does not preserve require.extensions list and assumes only ['.js'] #137

@snuggs

Description

@snuggs

Greetings!

Having a situation where we are using tape which does not pass extensions to resolve. Have opened an issue here tape-testing/tape#395

That being said our situation is we use the .es ECMAScript extension with the following:

require.extensions ['.es'] = require.extensions ['.js']

Although we can achieve our needs with the previous tape issue/pr I feel it behoves resolve to use the default require.extensions list provided by node instead of only assuming ['.js'] here

var extensions = opts.extensions || ['.js'];
.

An easy enhancement would be to convert:

var extensions = opts.extensions || ['.js'];

to

var extensions = opts.extensions
  || Object.keys (require.extensions)

Please advise and will have a PR & tests up ASAP as we need this or have to call off using tape and resolve. Can also enhance documentation which should close #134 which @ljharb, and @call-a3 are working on as well.

Thanks in advance! /cc @brandondees

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions