octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.
MIT License
6.83k stars 1k forks source link

[BUG]: CJS Loader "Unexpected token '{'" #2663

Closed maka-io closed 2 months ago

maka-io commented 2 months ago

What happened?

In a MeteorJS environment, adding import { Octokit } from 'octokit' results in immediate crash.

Versions

Octokit v3.2.0 Node v. 14.21.4

Relevant log output

app/node_modules/@octokit/core/dist-node/index.js:42
W20240425-13:36:58.188(-4)? (STDERR)   static {
W20240425-13:36:58.188(-4)? (STDERR)          ^
W20240425-13:36:58.188(-4)? (STDERR) 
W20240425-13:36:58.188(-4)? (STDERR) SyntaxError: Unexpected token '{'
W20240425-13:36:58.188(-4)? (STDERR)     at wrapSafe (internal/modules/cjs/loader.js:1031:16)
W20240425-13:36:58.189(-4)? (STDERR)     at Module._compile (internal/modules/cjs/loader.js:1080:27)


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
github-actions[bot] commented 2 months ago

👋 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 commented 2 months ago

You have to use ESM and we target ES2022.

We require NodeJS v18+

wolfy1339 commented 2 months ago

As per the Meteor docs,

Meteor 2.x runs on a deprecated Node.js version (14). Meteor 3.0, currently in its Release Candidate version, runs on Node.js v20. For more information, please consult our migration guide.

We support the 2 latest LTS releases, and provide support for the latest release.

The version we require is documented in our package.json and our build scripts