Skip to content

fix: resolve browser field in DTS generation for platform: browser - #1399

Open
godfengliang wants to merge 2 commits into
egoist:mainfrom
godfengliang:fix-dts-browser-field
Open

fix: resolve browser field in DTS generation for platform: browser#1399
godfengliang wants to merge 2 commits into
egoist:mainfrom
godfengliang:fix-dts-browser-field

Conversation

@godfengliang

Copy link
Copy Markdown

Problem

When using , the generated files resolve to the non-browser entry point because the DTS rollup resolver ignores the field in .

For example, a package with:

correctly bundles , but generates types from instead.

Fix

  1. Add option to type
  2. Pass to from
  3. In , when platform is , check the field mapping for types paths

Fixes #1397

When using --platform browser --dts, the DTS rollup resolver ignores the
browser field in package.json, causing type definitions to resolve to
the non-browser entry point.

This adds a platform option to tsResolvePlugin and applies browser
field mappings in packageFilter when platform is browser.

Fixes egoist#1397
@codesandbox

codesandbox Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

@godfengliang is attempting to deploy a commit to the EGOIST's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Insonsistent handling of the "browser" field

1 participant