Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a1ab11e

Browse filesBrowse files
authored
fix(pkg): add default fallback and types export (#419)
* fix(pkg): add a default fallback See octokit/core.js#665 octokit/core.js#667 * docs: add note on needed config changes for TypeScript
1 parent 3a17551 commit a1ab11e
Copy full SHA for a1ab11e

File tree

Expand file treeCollapse file tree

2 files changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-1
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ import { RequestError } from "@octokit/request-error";
3535
</tbody>
3636
</table>
3737

38+
> [!IMPORTANT]
39+
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json` by setting `"moduleResolution": "node16", "module": "node16"`.
40+
>
41+
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
42+
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
43+
3844
```js
3945
const error = new RequestError("Oops", 500, {
4046
request: {

‎scripts/build.mjs

Copy file name to clipboardExpand all lines: scripts/build.mjs
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ async function main() {
5050
{
5151
...pkg,
5252
files: ["dist-*/**", "bin/**"],
53-
main: "./dist-src/index.js",
5453
types: "./dist-types/index.d.ts",
5554
exports: {
5655
".": {
5756
types: "./dist-types/index.d.ts",
5857
import: "./dist-src/index.js",
58+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
59+
default: "./dist-src/index.js",
5960
}
6061
},
6162
sideEffects: false,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.