Skip to content

Commit 2cab8e2

Browse files
KyleBoyerwolfy1339
andauthored
fix(pkg): add a default fallback export (#195)
Co-authored-by: wolfy1339 <webmaster@wolfy1339.com>
1 parent 13a0b62 commit 2cab8e2

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
3838
</tbody>
3939
</table>
4040

41+
> [!IMPORTANT]
42+
> 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"`.
43+
>
44+
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
45+
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)
46+
4147
```js
4248
const MyOctokit = Octokit.plugin(paginateGraphQL);
4349
const octokit = new MyOctokit({ auth: "secret123" });

scripts/build.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ async function main() {
6060
{
6161
...pkg,
6262
files: ["dist-*/**", "bin/**"],
63-
main: "dist-bundle/index.js",
6463
types: "dist-types/index.d.ts",
6564
exports: {
6665
".": {
6766
types: "./dist-types/index.d.ts",
6867
import: "./dist-bundle/index.js",
68+
// Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint, ncc
69+
default: "./dist-bundle/index.js",
6970
}
7071
},
7172
sideEffects: false,

0 commit comments

Comments
 (0)