Skip to content

Commit f9e7991

Browse files
authored
fix(pkg): add a default fallback export (#480)
* 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
1 parent 1c92505 commit f9e7991

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ got[options.method](url, options);
9595
axios(requestOptions);
9696
```
9797

98+
> [!IMPORTANT]
99+
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json`. See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).
100+
98101
## API
99102

100103
### `endpoint(route, options)` or `endpoint(options)`

scripts/build.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,13 @@ async function main() {
6161
{
6262
...pkg,
6363
files: ["dist-*/**", "bin/**"],
64+
types: "./dist-types/index.d.ts",
6465
exports: {
6566
".": {
6667
types: "./dist-types/index.d.ts",
6768
import: "./dist-bundle/index.js",
69+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
70+
default: "./dist-bundle/index.js",
6871
},
6972
},
7073
sideEffects: false,

0 commit comments

Comments
 (0)