Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions fern/products/sdks/generators/typescript/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ const bar: MyRootType.Foo.Bar = {};
```
</ParamField>

<ParamField path="esmOnly" type="boolean" default="false" toc={true}>
Ships only the ECMAScript module (ESM) build of the generated package. By default, the generator publishes both CommonJS and ESM builds, which exposes consumers to the [dual package hazard](https://github.com/GeoffreyBooth/dual-package-hazard). When enabled, `package.json` sets `"type": "module"`, `main`, `module`, and `types` point at `./dist/esm/index.mjs` and `./dist/esm/index.d.mts`, the `exports` map (including subpackage exports) has no `require` conditions, and no `tsconfig.cjs.json` or `build:cjs` script is generated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] <FernStyles.Acronyms> reported by reviewdog 🐶
'ESM' has no definition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] <FernStyles.Acronyms> reported by reviewdog 🐶
'ESM' has no definition.


`esmOnly` can't be combined with `useLegacyExports: true` or `bundle: true`; generation fails with an error.

```yml title="generators.yml"
groups:
ts-sdk:
generators:
- name: fern-typescript-sdk
version: <Markdown src="/snippets/version-number-ts.mdx"/>
config:
esmOnly: true
```
</ParamField>

<ParamField path="extraDependencies" type="object" default="{}" toc={true}>

<Markdown src="/snippets/enterprise-plan.mdx"/>
Expand Down
Loading