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]: No "exports" main defined in version 6.0.1 #665

Closed
1 task done
Labels
released Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@marekdedic
Copy link

marekdedic commented Mar 5, 2024

What happened?

I updated @octokit/core to v6.0.1 and now I get the following error. See skaut/poptavky#1373

Versions

@octokit/core v6.0.1

Relevant log output

Error: No "exports" main defined in /home/user/project/node_modules/@octokit/core/package.json
    at exportsNotFound (node:internal/modules/esm/resolve:303:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:593:13)
    at resolveExports (node:internal/modules/cjs/loader:591:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:668:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/user/project/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/home/user/project/src/octokit.ts:1:1) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Code of Conduct

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

github-actions bot commented Mar 5, 2024

👋 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

We switched to ESM and you need to use the following options in your tsconfig.json:

"moduleResolution": "node16",
"module": "node16"

@wolfy1339 wolfy1339 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2024
@marekdedic
Copy link
Author

marekdedic commented Mar 5, 2024

Hi, thank you, unfortunately after adding that, the issue still persists. :(

@wolfy1339
Copy link
Member

You need to use ESM, right now your are outputting CJS
https://typestrong.org/ts-node/docs/imports#native-ecmascript-modules

wolfy1339 added a commit that referenced this issue Apr 8, 2024
wolfy1339 added a commit that referenced this issue Apr 9, 2024
* fix(pkg): add a default fallback

See #665 #667

* fix(pkg): add an export for `dist-types/types.d.ts`

Many people are importing from `dist-types/types.d.ts`, and the switch to ESM prevents them from using any of the types defined in that file.

* fix: mark `graphql` import as a type import

* docs: add note on needed config changes for TypeScript
Copy link
Contributor

github-actions bot commented Apr 9, 2024

🎉 This issue has been resolved in version 6.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

wolfy1339 added a commit to octokit/request-error.js that referenced this issue Apr 15, 2024
wolfy1339 added a commit to octokit/endpoint.js that referenced this issue Apr 15, 2024
wolfy1339 added a commit to octokit/plugin-rest-endpoint-methods.js that referenced this issue Apr 16, 2024
wolfy1339 added a commit to octokit/endpoint.js that referenced this issue Apr 16, 2024
* fix(pkg): add a `default` fallback export

See octokit/core.js#665 octokit/core.js#667

* docs(README): add note on needed config changes for TypeScript
wolfy1339 added a commit to octokit/request-error.js that referenced this issue Apr 16, 2024
* fix(pkg): add a default fallback

See octokit/core.js#665 octokit/core.js#667

* docs: add note on needed config changes for TypeScript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment