Skip to content

Derive vendor import-map entry points from package.json exports instead of hardcoding #1209

Description

@stipsan

Vendor entry points are hardcoded per package/version/subpath in VENDOR_IMPORTS and STYLED_COMPONENTS_IMPORTSpackages/@sanity/cli-build/src/actions/build/buildVendorDependencies.ts (e.g. react ./jsx-runtime, react-dom ./client / ./server).

Problem: when react/react-dom add a new subpath to their package.json exports, userland can't deploy an auto-updating studio importing it until we manually add it here and cut a release.

Goal: resolve the entry-point set automatically from each package's package.json exports, applying the conditions a browser bundler would (browser/import/default), replacing the manual table.

styled-components is the tricky case: it does not (yet) use exports conditions — it uses the webpack-style top-level browser field that remaps main. Needs a special case (and may move to exports later).

Follow-up from #1150.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions