Skip to content

Pin all @swc/core platform binaries as optionalDependencies - #1650

Merged
bdehamer merged 1 commit into
mainfrom
bdehamer/swc-cross-platform-bindings
May 22, 2026
Merged

Pin all @swc/core platform binaries as optionalDependencies#1650
bdehamer merged 1 commit into
mainfrom
bdehamer/swc-cross-platform-bindings

Conversation

@bdehamer

Copy link
Copy Markdown
Collaborator

Summary

Declares every supported @swc/core-* native binary in the root package.json so that package-lock.json records entries for all platforms, not just the one that ran npm install.

Problem

Without this, contributors and CI runners on a different OS/arch than whoever last regenerated the lockfile hit Bindings not found errors when running the test suite — every Jest suite fails to transform because @swc/core can't find a native binary for the current platform.

This is a known npm behaviour: a regenerated lockfile only includes the optional dep matching the host platform, even though @swc/core declares all of them as optionalDependencies.

Fix

Add all 9 platform binaries (darwin/linux/win × arm64/x64, plus musl and ia32 variants) as optionalDependencies at the root, pinned to the same version (1.5.0) that @swc/jest resolves @swc/core to. npm still only installs the binary matching the current platform at install time, but every platform's entry is now recorded in the lockfile.

Verification

  • rm -rf node_modules && npm install only installs @swc/core-darwin-arm64 locally
  • package-lock.json now contains entries for all 9 platforms
  • npm test — all 96 suites / 715 tests pass

@bdehamer
bdehamer requested a review from a team as a code owner May 22, 2026 17:46
@changeset-bot

changeset-bot Bot commented May 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: de2a841

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Declares every supported @swc/core-* native binary in the root
package.json so that package-lock.json records entries for all
platforms, not just the one that ran npm install.

Without this, contributors and CI runners on a different OS/arch
than whoever last regenerated the lockfile hit 'Bindings not found'
errors when running the test suite. npm still only installs the
binary matching the current platform at install time.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Brian DeHamer <bdehamer@github.com>

empty commit
@bdehamer
bdehamer force-pushed the bdehamer/swc-cross-platform-bindings branch from 17f3181 to de2a841 Compare May 22, 2026 17:47
@bdehamer
bdehamer merged commit 44a374d into main May 22, 2026
23 checks passed
@bdehamer
bdehamer deleted the bdehamer/swc-cross-platform-bindings branch May 22, 2026 18:01
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