Skip to content

fix: move package exports from publishConfig to top-level fields#318

Merged
kimyouknow merged 1 commit into
mainfrom
fix/publishconfig-to-toplevel
Feb 10, 2026
Merged

fix: move package exports from publishConfig to top-level fields#318
kimyouknow merged 1 commit into
mainfrom
fix/publishconfig-to-toplevel

Conversation

@kimyouknow
Copy link
Copy Markdown
Collaborator

Summary

  • react-simplikit@0.0.47 and @react-simplikit/mobile@0.0.1 were published with broken entry points (main: "./src/index.ts" instead of built output)
  • Root cause: changeset publish internally uses npm publish, which does NOT support publishConfig field overrides for manifest fields like main, types, module, exports
  • Previous version (0.0.46) worked because it was published via yarn npm publish (which does support this), before the changesets migration

Changes

packages/core/package.json

  • Move main, types, module, exports from publishConfig to top-level
  • Keep only publishConfig.access: "public"

packages/mobile/package.json

  • Same treatment as core

.changeset/fix-publishconfig.md

  • Patch changeset for both packages to trigger new releases (0.0.48 / 0.0.2)

Verification

$ npm pack (core)
main: ./dist/index.cjs      ✓ (was: ./src/index.ts)
types: ./dist/index.d.cts   ✓ (was: undefined)
module: ./esm/index.js      ✓ (was: undefined)
exports: { ... }            ✓ (was: undefined)

$ npm pack (mobile)
main: ./dist/index.cjs      ✓
types: ./dist/index.d.ts    ✓
module: ./dist/index.js     ✓
exports: { ... }            ✓

Expected release flow

This PR merge
  → changesets/action detects changeset → creates Version PR
     - react-simplikit: 0.0.47 → 0.0.48
     - @react-simplikit/mobile: 0.0.1 → 0.0.2

Version PR merge
  → changeset publish → npm publish
  → Correct main/types/exports in published package.json ✓

Test plan

  • npm pack for both packages shows correct top-level fields
  • yarn build succeeds for both packages
  • yarn changeset status shows both packages pending patch
  • After merge: Version PR auto-created
  • After Version PR merge: published packages have correct entry points

npm does not support publishConfig overrides for manifest fields (main,
types, module, exports). This caused 0.0.47 and @react-simplikit/mobile
0.0.1 to be published with incorrect entry points (pointing to source
instead of built output).

Move these fields to the top level of package.json so they are correctly
included regardless of the publish tool used.
@kimyouknow kimyouknow marked this pull request as draft February 10, 2026 14:16
@github-actions
Copy link
Copy Markdown
Contributor

Size Change: 0 B 🆕

Total Size: 0 B

compressed-size-action

@kimyouknow
Copy link
Copy Markdown
Collaborator Author

kimyouknow commented Feb 10, 2026

Snapshot Verification Results

Published canary versions and verified in a real consumer project:

1. npm registry fields — ✅ Correct

react-simplikit@0.0.0-canary-20260210142111
  main: ./dist/index.cjs
  types: ./dist/index.d.cts
  module: ./esm/index.js
  exports: ✓ (ESM + CJS with types)

@react-simplikit/mobile@0.0.0-canary-20260210142111
  main: ./dist/index.cjs
  types: ./dist/index.d.ts
  module: ./dist/index.js
  exports: ✓ (ESM + CJS with types)

2. Consumer project verification — ✅ Pass

Tested in some project (uses usePreservedCallback, useAsyncEffect, useBooleanState):

  • TypeScript typecheck (tsc --noEmit): ✅ Pass (0 errors)
  • Next.js production build (next build): ✅ Pass

3. Broken versions deprecated — ✅ Done

npm deprecate react-simplikit@0.0.47 "Broken: main/types/exports point to source. Use 0.0.46 or 0.0.48+"
npm deprecate @react-simplikit/mobile@0.0.1 "Broken: main/types/exports point to source. Upgrade to 0.0.2+"

Comparison: before vs after

Field 0.0.47 (broken) canary (fixed)
main ./src/index.ts ./dist/index.cjs
types undefined ❌ ./dist/index.d.cts
module undefined ❌ ./esm/index.js
exports undefined ❌ ESM+CJS ✅

@kimyouknow kimyouknow marked this pull request as ready for review February 10, 2026 14:33
@kimyouknow kimyouknow merged commit 466e3ce into main Feb 10, 2026
10 checks passed
@kimyouknow kimyouknow deleted the fix/publishconfig-to-toplevel branch February 10, 2026 14:34
@github-actions github-actions Bot mentioned this pull request Feb 10, 2026
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.

1 participant