Skip to content

Commit 3b41d1f

Browse files
authored
fix(pkg): add a default fallback export (#262)
* fix(pkg): add a default fallback export * docs: add note on needed config changes for TypeScript
1 parent 41c295e commit 3b41d1f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,12 @@ createOAuthAppAuth({
554554
</tbody>
555555
</table>
556556

557+
> [!IMPORTANT]
558+
> 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"`.
559+
>
560+
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
561+
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
562+
557563
## `auth(options)` or `octokit.auth(options)`
558564

559565
The async `auth()` method is returned by `createOAuthUserAuth(options)` or set on the `octokit` instance when the `Octokit` constructor was called with `authStrategy: createOAuthUserAuth`.

scripts/build.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ async function main() {
5858
{
5959
...pkg,
6060
files: ["dist-*/**", "bin/**"],
61-
main: "./dist-bundle/index.js",
6261
types: "./dist-types/index.d.ts",
6362
exports: {
6463
".": {
6564
types: "./dist-types/index.d.ts",
6665
import: "./dist-bundle/index.js",
66+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
67+
default: "./dist-bundle/index.js",
6768
},
6869
},
6970
sideEffects: false,

0 commit comments

Comments
 (0)