ReviewOS

craft-native/craft

packages: put framework type conditions before runtime exports

#274
Closed glennmichael123 opened this 10 days ago ·
10 days ago

Problem

Building @craft-native/react, @craft-native/vue, and @craft-native/svelte emits the same warning: each exports["."] object lists types after import and require, so ordered conditional-export resolution reaches a runtime target first and never uses the explicit type condition.

All three packages also have a top-level types field, which masks this for some consumers, but the conditional map should be valid on its own—especially for NodeNext/bundler resolution and package-validation tools. Svelte additionally places types after svelte, import, and require.

This was found during the release-readiness audit following #254, #242, and #220; it is outside those issue lanes.

Evidence

bun run build:react, build:vue, and build:svelte all succeed but tsup/esbuild warns: “The condition types here will never be used as it comes after both import and require.”

Suggested acceptance criteria

  • Put types before runtime conditions in each framework package export map.
  • Preserve the Svelte source condition and CJS/ESM targets.
  • Add a package-consumer fixture using modern TypeScript module resolution to prove each package resolves its declaration file through exports.
  • Keep the package build warning-free.

Sign in to comment on this issue.