Skip to content

Commit 07147dc

Browse files
authored
fix: add a default fallback export (#247)
* fix(pkg): add a default fallback export * docs: add note on needed config changes for TypeScript * build: add types field
1 parent 7470bc0 commit 07147dc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: README.md

+6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ import {
7474
</tbody>
7575
</table>
7676

77+
> [!IMPORTANT]
78+
> 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"`.
79+
>
80+
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
81+
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
82+
7783
### OAuth Web Flow
7884

7985
After a user granted access to an OAuth App or GitHub App on [Step 1 of GitHub's OAuth Web Flow](https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps#1-request-a-users-github-identity), they get redirected to a URL controlled by your app with a `?code=...` query parameter.

Diff for: scripts/build.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ async function main() {
6262
{
6363
...pkg,
6464
files: ["dist-*/**", "bin/**"],
65+
types: "./dist-types/index.d.ts",
6566
exports: {
6667
".": {
6768
types: "./dist-types/index.d.ts",
6869
import: "./dist-bundle/index.js",
70+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint
71+
default: "./dist-bundle/index.js",
6972
},
7073
},
7174
sideEffects: false,

0 commit comments

Comments
 (0)