Skip to content

package.exports require "./" in front of path or resolver fails #32034

Closed
@MylesBorins

Description

@MylesBorins

Had a bug report for one of my module due to resolution issues. Specifically the below doesn't work

{
  "exports": "lib/index.js"
{

But the below does

{
  "exports": "./lib/index.js"
}

This is inconsistent with the behavior of main where the ./ is not required in relative paths.

To make matters even more confusing there is no failure when attempting to load a module as self-referential.

TBH this seems like a bug. Even if it was intentional design it is very easy to get wrong and was hard to debug.

/cc @nodejs/modules thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions