octokit / octokit.js

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

[BUG]: Error when importing react component with octokit dependency #2447

Closed rwxmad closed 1 year ago

rwxmad commented 1 year ago

What happened?

I have a react+typescript component that has an octokit dependency.

import React, { FC, useEffect, useState } from "react";
import { Octokit } from "octokit";

export const Graph: FC<IProps> = ({ token, theme }) => {...code}

Project structure:

.
├── example
│  ├── public
│  │  └── index.html
│  ├── src
│  │  ├── App.tsx
│  │  ├── index.css
│  │  └── index.tsx
│  ├── .gitignore
│  ├── package-lock.json
│  ├── package.json
│  ├── README.md
│  └── tsconfig.json
├── lib
│  ├── components
│  │  ├── Graph.d.ts
│  │  └── Graph.js
│  ├── index.d.ts
│  └── index.js
├── src
│  ├── components
│  │  └── Graph.tsx
│  └── index.tsx
├── .gitignore
├── package-lock.json
├── package.json
└── tsconfig.json

I use tsc to build everything from src to the lib folder, and in the example folder I created a project using create-react-app, where I import the component from lib/index.js, which was compiled with tsc. But when I run the application in the folder example produces an error:

Failed to parse source map from '/Users/rwxmad/code/github/react-github-contribution-graph/node_modules/@octokit/auth-app/dist-node/index.js.map' file: Error: ENOENT: no such file or directory, open '/Users/rwxmad/code/github/react-github-contribution-graph/node_modules/@octokit/auth-app/dist-node/index.js.map'

How to fix that error?

Versions

Octokit v2.0.14 NodeJs v19.8.1

Relevant log output

No response

Code of Conduct

wolfy1339 commented 1 year ago

Duplicate of https://github.com/octokit/auth-app.js/issues/474

rwxmad commented 1 year ago

@wolfy1339 still not working, how to fix?

wolfy1339 commented 1 year ago

Can you share the versions for All Octokit modules installed?

The ones listed in your lock file

rwxmad commented 1 year ago

Can you share the versions for All Octokit modules installed?

The ones listed in your lock file

https://github.com/rwxmad/react-github-contribution-graph/blob/main/package-lock.json

Installed via npm i octokit

wolfy1339 commented 1 year ago

I believe in this case, it would be https://github.com/octokit/request.js/pull/584 that is now blocking you

rwxmad commented 1 year ago

I believe in this case, it would be octokit/request.js#584 that is now blocking you

Thank you for your help, I'll be waiting then