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

Unable to resolve a package by its own name #289

Open
fasttime opened this issue Aug 14, 2022 · 2 comments
Open

Unable to resolve a package by its own name #289

fasttime opened this issue Aug 14, 2022 · 2 comments

Comments

@fasttime
Copy link

This is a reminder that package self-referencing is not supported at this time.

package.json

{
  "name": "my-package",
  "main": "./index.js",
  "dependencies": {
    "resolve": "*"
  },
  "exports": {
    ".": "./index.js"
  }
}

index.js

const resolve = require('resolve/sync');

// prints full path of index.js
console.log(`require.resolve: ${require.resolve('my-package')}`);

// throws MODULE_NOT_FOUND
console.log(`resolve: ${resolve('my-package')}`);

DEMO LINK


I imagine this must be a known limitation, since other features linked to module resolution in Node like package imports are not supported either. I'm reporting this here anyway because I could not find a reference to this in the documentation or in any of the other issues.

@ljharb
Copy link
Member

ljharb commented Aug 14, 2022

Yes, the reminder isn’t necessary - we don’t yet support “exports” or any of the features that landed with it, including self-referencing.

@alejooroncoy

This comment was marked as spam.

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

No branches or pull requests

3 participants