question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage in ESM project broken in v1.8.0

See original GitHub issue

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]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
dotansimhacommented, Sep 26, 2021

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 https://github.com/contrawork/graphql-helix/pull/44

Working on a fix. Thank you

3reactions
PabloSzxcommented, Sep 24, 2021

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

the “exports” literally doesn’t have any “import” field for ESM

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESM only breaks everything · Issue #1263 · node-fetch/node ...
This move will cause MANY projects that's sole purpose is to mock node-fetch to cease to work with no real way to work...
Read more >
file-loader - webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Creating a React Component Library using Rollup, Typescript ...
This component library would enable teams to pull down an NPM package, import components, provide some props and have their components ready to ......
Read more >
Download & Update Node.js to the Latest Version! Node v19 ...
Direct download links to update to the latest Node.js versions: Node v19.0.0 / LTS v16.18.0.
Read more >
Error: require() of ES module is no supported when using ...
Error: Must use import to load ES Module: project_path\node_modules\d3-shape\src\index.js require() of ES modules is not supported. require() of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found