Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with package exports #9

Open
simonihmig opened this issue Feb 16, 2023 · 4 comments
Open

Does not work with package exports #9

simonihmig opened this issue Feb 16, 2023 · 4 comments

Comments

@simonihmig
Copy link

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. 🤔

@sindresorhus
Copy link
Owner

See: nodejs/node#42219

There's unfortunately no reliable way to do this at the moment.

@simonihmig
Copy link
Author

Interesting, thank you!

@sindresorhus
Copy link
Owner

Keeping this open for discoverability.

@gvdp
Copy link

gvdp commented Mar 9, 2023

This seems to also break some functionality with commit hooks in lerna. Not sure if and where it can be fixed but just linked the issues for visibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants