Skip to content

Commit cf1468d

Browse files
authored
fix(pkg): add a default fallback export (#523)
* fix(pkg): add a default fallback export * docs: add note on needed config changes for TypeScript
1 parent e37839f commit cf1468d

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
@@ -66,6 +66,12 @@ Install with `npm install @octokit/oauth-app`
6666
</tbody>
6767
</table>
6868

69+
> [!IMPORTANT]
70+
> 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"`.
71+
>
72+
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
73+
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
74+
6975
### For OAuth Apps
7076

7177
```js

scripts/build.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ async function main() {
6767
{
6868
...pkg,
6969
files: ["dist-*/**", "bin/**"],
70-
main: "./dist-node/index.js",
7170
types: "./dist-types/index.d.ts",
7271
exports: {
7372
".": {
7473
types: "./dist-types/index.d.ts",
7574
import: "./dist-node/index.js",
75+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
76+
default: "./dist-node/index.js",
7677
},
7778
},
7879
sideEffects: false,

0 commit comments

Comments
 (0)