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

New exports field in package.json get wrong mapping #89

Closed
3cp opened this issue Oct 2, 2020 · 1 comment
Closed

New exports field in package.json get wrong mapping #89

3cp opened this issue Oct 2, 2020 · 1 comment

Comments

@3cp
Copy link

3cp commented Oct 2, 2020

This package got new field in package.json

  "exports": {
    ".": [
      {
        "default": "./index.js"
      },
      "./index.js"
    ],
    "./package": "./package.json",
    "./package.json": "./package"
  },

However, it doesn't work.

To reproduce the error, go to an empty folder.

npm i deep-equal
node
> require('deep-equal/package.json')
Uncaught Error: Cannot find module 'deep-equal/package.json'
Require stack:
- <repl>
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.resolve (internal/modules/cjs/helpers.js:78:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '<repl>' ]
}

The fix:
Change

"./package.json": "./package"

To

"./package.json": "./package.json"
@ljharb
Copy link
Member

ljharb commented Oct 2, 2020

You're totally right, thanks. I'll fix that.

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

2 participants