Patch to make @octokit/types work with vite/astro
Last Modified:
.Published On:

Photograph by Roman Synkevych on Unsplash
If you are using node, usepatch-package. If you are using pnpm use the in-builtpatch command.
Trying to use@octokit/types
with vite/astro? You might run intothis kind of error
This is because of how vite.js resolves packages.@octokit/types
doesn't export any javascript file, so vite says
I don't recognise you, can't let you in.
You need to add a dummymain
file in the package's package.json to make it happy. This is how patched package.json of@octokit/types
should look like
diff --git a/index.js b/index.jsnew file mode 100644index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391diff --git a/package.json b/package.jsonindex 7ee12d257f4213c3583c11acbfde95895f80d261..2693b41cab2f0865f76de2bff5e600a114ccf6e4 100644--- a/package.json+++ b/package.json@@ -43,5 +43,13 @@ "dist-types/**" ], "types": "dist-types/index.d.ts",+ "exports": {+ ".": {+ "import": "./index.js",+ "require": "./index.js",+ "types": "./dist-types/index.d.ts"+ }+ },+ "main": "./index.js", "sideEffects": false }
If this helped you down, consider giving me a shout out on twitter :)
- Next: Iterators for Pagination
- Previous: Struggling Experiences At Hospitals