Usage in ESM project broken in v1.8.0
See original GitHub issueStarting 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:
- Created 2 years ago
- Reactions:5
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
the “exports” literally doesn’t have any “import” field for ESM