Skip to content

feat: add Linux musl target support#995

Merged
fengmk2 merged 62 commits intomainfrom
support-musl
Mar 24, 2026
Merged

feat: add Linux musl target support#995
fengmk2 merged 62 commits intomainfrom
support-musl

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Mar 17, 2026

Summary

Add build, publish, and CI support for Linux musl targets (x86_64-unknown-linux-musl and aarch64-unknown-linux-musl), enabling vite-plus to run in Alpine/musl-based Docker containers.

  • Add musl NAPI binding targets to package.json and release workflow
  • Cross-compile musl binaries using cargo-zigbuild (napi-cross only supports gnu)
  • Download musl Node.js from unofficial-builds.nodejs.org (official nodejs.org only provides glibc)
  • Add test-musl CI job running cargo check/test in Alpine container
  • Add cli-e2e-test-musl CI job with snap tests in Alpine Docker
  • Add musl standalone install tests (test-standalone-install.yml)
  • Add libc filter support to snap test ignoredPlatforms (e.g. { "os": "linux", "libc": "musl" })
  • Replace cat FILE && exit 1 || true with portable test ! -f FILE in snap tests
  • Add platform support documentation to getting started guide

Test plan

  • cargo test -p vite_global_cli — registry test includes musl
  • test-musl job — cargo check + test in Alpine container
  • cli-e2e-test-musl job — full E2E with snap tests in Alpine Docker
  • test-standalone-install.yml — musl x64 + arm64 install tests
  • Release workflow builds 8 targets (6 existing + 2 musl)

Closes #992

@fengmk2 fengmk2 self-assigned this Mar 17, 2026
Copy link
Member Author

fengmk2 commented Mar 17, 2026


How to use the Graphite Merge Queue

Add the label auto-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 2 times, most recently from 475016b to 45e4691 Compare March 17, 2026 15:16
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 45e4691 to bc38b7a Compare March 18, 2026 01:50
@fengmk2 fengmk2 marked this pull request as ready for review March 18, 2026 01:51
@fengmk2 fengmk2 requested a review from Brooooooklyn March 18, 2026 01:51
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from bc38b7a to 810d51c Compare March 18, 2026 02:16
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 810d51c to efc5c42 Compare March 18, 2026 02:28
@Brooooooklyn
Copy link
Member

@fengmk2 should also add musl target cargo tests and cli e2e tests

@fengmk2 fengmk2 force-pushed the support-musl branch 2 times, most recently from c63425a to 7ffe689 Compare March 18, 2026 03:51
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from efc5c42 to d143fc6 Compare March 18, 2026 03:51
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch 2 times, most recently from 9db93c2 to cc73dcc Compare March 18, 2026 06:05
@fengmk2 fengmk2 force-pushed the support-musl branch 2 times, most recently from e49456f to 2572e70 Compare March 18, 2026 06:08
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from cc73dcc to 000f043 Compare March 18, 2026 06:08
@fengmk2 fengmk2 force-pushed the trampoline-exe-for-shims branch from 000f043 to 00ae674 Compare March 18, 2026 06:15
fengmk2 and others added 14 commits March 24, 2026 14:06
Published vite-plus 0.1.13 doesn't include musl NAPI bindings yet.
Skip tests that depend on the npm-published package on musl targets:
- migration tests that install vite-plus@latest
- command-pack-exe (uses tsdown which loads rolldown binding)
- command-upgrade-check

Remove debug steps from CI now that root cause is identified.
The snap test runner passes CI through to subprocesses, and vp
commands may behave differently in CI mode.
Alpine's cat outputs "can't open" while GNU cat outputs "No such file
or directory". Use test ! -f which is portable and produces no output.
- Replace cat FILE checks with test ! -f in remaining snap tests:
  command-init-inline-config-existing, migration-existing-lint-staged-config,
  migration-eslint-lintstagedrc, create-missing-typecheck
- Skip command-dlx-npm10 on musl
fengmk2 added 5 commits March 24, 2026 14:29
In CI environments (especially Docker containers), the log file path
is not accessible to the user. Print the log contents directly when
CI=true.
Pass CI=true so install.sh prints log contents on failure instead of
pointing to a file. Use bash -x for full debug trace output.
The error() function calls exit 1 internally, so the cat of the
install log was never reached. Use echo directly with the CI check
before exiting.
…released

The published vp binary (alpha) downloads glibc Node.js from
nodejs.org. The musl fix (unofficial-builds.nodejs.org) is in this
PR but not yet released. These tests will work after the first
musl-enabled release.
The unofficial-builds Node.js musl binary dynamically links to
libstdc++.so.6 and libgcc_s.so.1 (uses musl libc but GNU C++ runtime).
Install libstdc++ in Alpine containers for the musl install tests.
@fengmk2 fengmk2 merged commit 1462953 into main Mar 24, 2026
36 checks passed
@fengmk2 fengmk2 deleted the support-musl branch March 24, 2026 09:46
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.

vite-plus fails to resolve native binding @voidzero-dev/vite-plus-linux-x64-musl when installed with Bun in Docker (Alpine/musl)

3 participants