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

[BUG]: v5.0 is failing with "SyntaxError: … does not provide an export named 'paginateGraphQL'" #180

Closed
1 task done
awendt opened this issue Mar 12, 2024 · 7 comments · Fixed by #181
Closed
1 task done
Labels
Type: Bug Something isn't working as documented

Comments

@awendt
Copy link

awendt commented Mar 12, 2024

What happened?

Trying to use the package as documented:

$ npm install @octokit/core @octokit/plugin-paginate-graphql --save

added 11 packages, and audited 12 packages in 3s

found 0 vulnerabilities

My package.json for a minimal example:

{
  "name": "plugin-paginate-graphql",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@octokit/core": "^6.0.1",
    "@octokit/plugin-paginate-graphql": "^5.0.0"
  }
}
// test-plugin.js
import { Octokit } from "@octokit/core";
import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";

Then:

$ node test-plugin.js
import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
         ^^^^^^^^^^^^^^^
SyntaxError: The requested module '@octokit/plugin-paginate-graphql' does not provide an export named 'paginateGraphQL'

Am I missing something?

Versions

  • Node.js v20.5.1
  • @octokit/core v6.0.1
  • @octokit/plugin-paginate-graphql v5.0.0

Relevant log output

$ node test-plugin.js
file:///Users/andrewendt/tmp/plugin-paginate-graphql/test-plugin.js:2
import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
         ^^^^^^^^^^^^^^^
SyntaxError: The requested module '@octokit/plugin-paginate-graphql' does not provide an export named 'paginateGraphQL'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:122:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:188:5)
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24)
    at async loadESM (node:internal/process/esm_loader:40:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Node.js v20.5.1

Code of Conduct

  • I agree to follow this project's Code of Conduct
@awendt awendt added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Mar 12, 2024
Copy link

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@wolfy1339
Copy link
Member

This is very annoying... This isn't the first time this issue has been brought up with Octokit packages.

It's something to do with the exports map in the package.json, we haven't quite nailed down the proper format quite yet

Can you try changing it so that the exports map looks like so:

"exports": {
    "types": "dist-types/index.d.ts",
    "import": "dist-bundle/index.js"
}

@wolfy1339 wolfy1339 removed the Status: Triage This is being looked at and prioritized label Mar 12, 2024
@awendt
Copy link
Author

awendt commented Mar 13, 2024

@wolfy1339 There is no dist-bundle folder:

$ tree node_modules/@octokit/plugin-paginate-graphql/
node_modules/@octokit/plugin-paginate-graphql/
├── LICENSE
├── README.md
├── dist-node
│   ├── index.js
│   └── index.js.map
├── dist-src
│   ├── errors.js
│   ├── extract-page-info.js
│   ├── index.js
│   ├── iterator.js
│   ├── merge-responses.js
│   ├── object-helpers.js
│   ├── page-info.js
│   └── paginate.js
├── dist-types
│   ├── errors.d.ts
│   ├── extract-page-info.d.ts
│   ├── index.d.ts
│   ├── iterator.d.ts
│   ├── merge-responses.d.ts
│   ├── object-helpers.d.ts
│   ├── page-info.d.ts
│   └── paginate.d.ts
├── dist-web
│   ├── index.js
│   └── index.js.map
└── package.json

That's why changing the exports as you suggested leads to:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/path/to/plugin-paginate-graphql/node_modules/@octokit/plugin-paginate-graphql/dist-bundle/index.js' imported from /path/to/plugin-paginate-graphql/test-plugin.js

@kachick
Copy link

kachick commented Mar 13, 2024

Is this a different issue of #177?

The PR for it #178 is not yet released to npm https://www.npmjs.com/package/@octokit/plugin-paginate-graphql?activeTab=versions

@awendt
Copy link
Author

awendt commented Mar 13, 2024

Is this a different issue of #177?

The PR for it #178 is not yet released to npm https://www.npmjs.com/package/@octokit/plugin-paginate-graphql?activeTab=versions

Good point! Is there any way for me to test that change without a release?

@kachick
Copy link

kachick commented Mar 13, 2024

Now I'm just waiting for the official release.
But when I tried to solve this, build and adjust structure for dist-* and pointing with git path from dependent repository.

Below is my struggle log...

screen_shot 2024-03-13 19 54 50

@wolfy1339
Copy link
Member

The release workflow is currently failing, it will get fixed by #181

@wolfy1339 wolfy1339 linked a pull request Mar 13, 2024 that will close this issue
4 tasks
@gr2m gr2m closed this as completed in #181 Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants