Skip to content

Commit

Permalink
fix(pkg): add a default fallback export (#480)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
wolfy1339 committed Apr 16, 2024
1 parent 1c92505 commit f9e7991
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ got[options.method](url, options);
axios(requestOptions);
```

> [!IMPORTANT]
> 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).
## API

### `endpoint(route, options)` or `endpoint(options)`
Expand Down
3 changes: 3 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ async function main() {
{
...pkg,
files: ["dist-*/**", "bin/**"],
types: "./dist-types/index.d.ts",
exports: {
".": {
types: "./dist-types/index.d.ts",
import: "./dist-bundle/index.js",
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
default: "./dist-bundle/index.js",
},
},
sideEffects: false,
Expand Down

0 comments on commit f9e7991

Please sign in to comment.