Skip to content

fix(mrt-utilities): strip development export conditions during pack to prevent consumer resolution failures#379

Merged
bendvc merged 2 commits intomainfrom
bendvc/fix-mrt-utilites-exports
Apr 24, 2026
Merged

fix(mrt-utilities): strip development export conditions during pack to prevent consumer resolution failures#379
bendvc merged 2 commits intomainfrom
bendvc/fix-mrt-utilites-exports

Conversation

@bendvc
Copy link
Copy Markdown
Collaborator

@bendvc bendvc commented Apr 24, 2026

PR Description

Why this change

@salesforce/mrt-utilities exposed development export conditions that point to ./src/*, while the published package only ships dist/*.
In environments that include the development condition (for example Vite dev resolution), consumers can match development first and attempt to load non-published source files, causing module resolution failures instead of falling back to import/require.

What we changed

  • Added packages/mrt-utilities/scripts/strip-dev-exports.cjs.
  • Added lifecycle hooks in packages/mrt-utilities/package.json:
    • prepack: runs the strip script to remove development keys from exports.
    • postpack: restores package.json via git checkout package.json.
  • Added a changeset:
    • .changeset/mrt-utilities-strip-dev-exports.md (@salesforce/mrt-utilities: patch).

Existing pattern reused

This follows the same proven approach already used in @salesforce/b2c-tooling-sdk:

  • Keep development export conditions in source for local monorepo/dev ergonomics.
  • Remove those conditions during packing/publishing so npm consumers only resolve to published dist artifacts.

Smoke test steps

  1. From repo root, run:
    • pnpm --filter @salesforce/mrt-utilities pack --pack-destination /tmp
  2. Verify command output includes:
    • prepack execution and Stripped "development" condition from ... export(s)
    • successful tarball creation (e.g. /tmp/salesforce-mrt-utilities-<version>.tgz)
  3. Verify packed contents are publish-safe:
    • tarball lists dist/**, package.json, README.md
    • no src/** files in tarball
  4. (Optional extra check) inspect packaged package.json inside tarball and confirm exports entries do not include development.
  5. Confirm working tree still contains intended source changes after test (if needed, re-open packages/mrt-utilities/package.json to verify prepack/postpack scripts remain present).

@bendvc bendvc requested a review from clavery as a code owner April 24, 2026 15:44
@bendvc bendvc requested review from kevinxh and kieran-sf April 24, 2026 15:44
@bendvc bendvc merged commit c89e045 into main Apr 24, 2026
5 checks passed
@bendvc bendvc deleted the bendvc/fix-mrt-utilites-exports branch April 24, 2026 15:56
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.

2 participants