Document esmOnly option for the TypeScript SDK generator - #6942
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Document esmOnly option for the TypeScript SDK generator#6942devin-ai-integration[bot] wants to merge 1 commit into
esmOnly option for the TypeScript SDK generator#6942devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
devin-ai-integration
Bot
requested review from
devalog,
jkonrath-postman and
nerminamiller-postman
as code owners
September 13, 2026 17:05
| </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. |
Contributor
There was a problem hiding this comment.
📝 [vale] <FernStyles.Acronyms> reported by reviewdog 🐶
'ESM' has no definition.
| </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. |
Contributor
There was a problem hiding this comment.
📝 [vale] <FernStyles.Acronyms> reported by reviewdog 🐶
'ESM' has no definition.
Contributor
|
🌿 Preview your docs: https://fern-preview-devin-1789319077-ts-esm-only.docs.buildwithfern.com/learn Here are the markdown pages you've updated: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The TypeScript SDK generator gained an opt-in
esmOnlyconfig option that makes the generated package ship only an ESM build instead of the default dual CommonJS + ESM output. This matters for customers whose consumers are ESM-only: it avoids the dual package hazard (two copies of the same module loaded viarequireandimport) and yields a smaller, single-format package. Default behavior is unchanged when the flag is omitted.Implements docs for: feat(typescript): add opt-in esmOnly flag for ESM-only SDK output (fern-api/fern#17503) — fern-api/fern#17503
Details
fern/products/sdks/generators/typescript/configuration.mdx: new<ParamField path="esmOnly" type="boolean" default="false">entry, placed alphabetically betweenenableInlineTypesandextraDependencies. Covers thepackage.json/exports/ build-script effects, the dual package hazard motivation, the incompatibility withuseLegacyExports: trueandbundle: true, and agenerators.ymlexample. The page has nooutputEsmentry, so no contrast was added.Vale: the only remaining findings in the new block are
FernStyles.Acronymssuggestions forESM, which is defined on first use.fern check --warningspasses with 0 errors.Link to Devin session: https://app.devin.ai/sessions/9854c806214d470da26ea53336829309
Open in Devin Desktop: https://app.devin.ai/desktop/session/9854c806214d470da26ea53336829309?variant=devin