diff --git a/README.md b/README.md index 95b62de8..164f60d1 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,9 @@ got[options.method](url, options); axios(requestOptions); ``` +> [!IMPORTANT] +> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json`. See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports). + ## API ### `endpoint(route, options)` or `endpoint(options)` diff --git a/scripts/build.mjs b/scripts/build.mjs index 3363b684..e8f962df 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -61,10 +61,13 @@ async function main() { { ...pkg, files: ["dist-*/**", "bin/**"], + types: "./dist-types/index.d.ts", exports: { ".": { types: "./dist-types/index.d.ts", import: "./dist-bundle/index.js", + // Tooling currently are having issues with the "exports" field when there is no "default", ex: TypeScript, eslint + default: "./dist-bundle/index.js", }, }, sideEffects: false,