Alpine didn't break your Vite build. A missing optional dependency did.
The advice is everywhere in Docker threads: if a Node build fails on Alpine, switch to Debian.
I tested that claim against a real Vite 7 / React 19 / Tailwind 4 app. Alpine was innocent.
The test
Same source, four setups, one question: does the build produce a working bundle?
Setup node_modules/@rollup Build
node:22-alpine , npm install rollup-linux-x64-musl β
passes
node:22-alpine , npm ci with a lockfile generated on Debian rollup-linux-x64-gnu , rollup-linux-x64-musl β
passes
node:22-alpine , npm install --omit=optional (empty) β fails immediately
node:22-bookworm-slim , npm ci rollup-linux-x64-gnu , rollup-linux-x64-musl β
passes
A clean install on musl builds a React app without complaint. So the base image is not the variable. The variable is whether Rollup's native parser got installed .
Why the parser is a package
Rollup 4 parses JavaScript with a native binary, not with JavaScript.β¦