Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Usage in ESM project broken in v1.8.0 #62

Closed
avaly opened this issue Sep 24, 2021 · 5 comments
Closed

Usage in ESM project broken in v1.8.0 #62

avaly opened this issue Sep 24, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@avaly
Copy link

avaly commented Sep 24, 2021

Starting with version 1.8.0 using this package in an ESM project is broken. The most likely commit which broke it is #47.

Steps to reproduce

package.json:

{
  "name": "graphql-helix-bugs",
  "type": "module",
  "dependencies": {
    "graphql": "15.6.0",
    "graphql-helix": "1.8.0"
  }
}

index.js:

import { processRequest } from 'graphql-helix';

console.log(processRequest);

Actual result

$ node index.js 
internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /tmp/graphql-helix-bugs/node_modules/graphql-helix/package.json imported from /tmp/graphql-helix-bugs/index.js
    at throwExportsNotFound (internal/modules/esm/resolve.js:290:9)
    at packageExportsResolve (internal/modules/esm/resolve.js:479:7)
    at packageResolve (internal/modules/esm/resolve.js:644:14)
    at moduleResolve (internal/modules/esm/resolve.js:696:18)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:810:11)
    at Loader.resolve (internal/modules/esm/loader.js:86:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:230:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:56:40)
    at link (internal/modules/esm/module_job.js:55:36) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Expected result

Downgrading to v1.7.0:

$ node index.js 
[AsyncFunction: processRequest]
@dotansimha
Copy link
Contributor

@n1ru4l @PabloSzx ideas?

@PabloSzx
Copy link
Contributor

Screenshot from 2021-09-24 12-43-59

the "exports" literally doesn't have any "import" field for ESM

@jvbianchi
Copy link

@dotansimha
Copy link
Contributor

Screenshot from 2021-09-24 12-43-59

the "exports" literally doesn't have any "import" field for ESM

Oh oops! I somehow forget to include some ESM changes from #44

Working on a fix. Thank you

@dotansimha dotansimha added the bug Something isn't working label Oct 7, 2021
@dotansimha
Copy link
Contributor

dotansimha commented Oct 7, 2021

Fixed by @n1ru4l in #65
Fix is available as [email protected].

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Development

No branches or pull requests

4 participants