Skip to content

Does not work with package exports #9

@simonihmig

Description

@simonihmig

Given a package that has exports in its package.json, like this:

{
    "exports": {
    ".": "./dist/index.js",
    "./*": {
      "types": "./dist/*.d.ts",
      "default": "./dist/*.js"
    }
  }
}

When trying to resolve that package, a MODULE_NOT_FOUND error is thrown with "Cannot find module '/path/to/my-package/dist/package.json.js'"

Basically the assumption here that you can always resolve the package.json of a package using node does not hold true anymore in this case. Still I'd like to be able to get the root path of that package, using node module resolution rules. 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions