Skip to content

Commit c0a22d3

Browse files
authored
fix(pkg): add a default fallback export (#368)
* fix(pkg): add a default fallback export * docs: add note on needed config changes for TypeScript
1 parent 8d83536 commit c0a22d3

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
@@ -55,6 +55,12 @@ const { oauthAuthorizationUrl } = require("@octokit/oauth-authorization-url");
5555
</tbody>
5656
</table>
5757

58+
> [!IMPORTANT]
59+
> 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"`.
60+
>
61+
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
62+
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
63+
5864
### For OAuth Apps
5965

6066
```js

scripts/build.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ async function main() {
5252
{
5353
...pkg,
5454
files: ["dist-*/**"],
55-
main: "./dist-src/index.js",
5655
types: "./dist-types/index.d.ts",
5756
exports: {
5857
".": {
5958
types: "./dist-types/index.d.ts",
6059
import: "./dist-src/index.js",
60+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
61+
default: "./dist-src/index.js",
6162
},
6263
},
6364
sideEffects: false,

0 commit comments

Comments
 (0)