Wire up Rspack builds, dev server, asset namespacing and CI (Rspack split 4/4)

Wires the Rspack build and dev server end to end, selected by a single ENABLE_RSPACK variable:

  • Dev server: scripts/frontend/webpack_dev_server.js runs rspack serve when ENABLE_RSPACK=true (otherwise the Webpack dev server), on the same dev-server port.
  • Production build: assets.rake builds with Rspack under ENABLE_RSPACK.
  • Manifest: Rspack emits manifest.rspack.json next to Webpack's manifest.json in the same /assets/webpack/ folder (content-hashed files coexist). Gitlab::Webpack::Manifest can load either manifest (memoized per filename), and WebpackHelper reads the Rspack one when ENABLE_RSPACK is set.
  • Asset SHA: assets_sha namespaces the compiled-output cache key by bundler, so Rspack and Webpack never share the CI cache.
  • CI: skips the Webpack-only jobs (dev-server memory test, bundle-size review) when ENABLE_RSPACK is set; .mjs config changes trigger the right jobs.

Inert by default: nothing changes unless ENABLE_RSPACK is set.

Verify locally

Production build + static serve

ENABLE_RSPACK=true NODE_ENV=production yarn build   # or: yarn rspack-prod

Rspack compiles with 0 errors and emits content-hashed, gzipped bundles plus manifest.rspack.json to public/assets/webpack/. To serve that build through Rails:

gdk config set webpack.enabled false && gdk reconfigure   # revert with `true`

With ENABLE_RSPACK=true in the Rails environment, open the key pages (MR diffs, repository, boards, dashboard) and confirm they render with no console errors.

Dev server

ENABLE_RSPACK=true yarn dev-server

Runs rspack serve (HMR + lazy compilation) on the Webpack dev-server port; Rails proxies /assets/webpack to it and, with ENABLE_RSPACK=true in the Rails environment, reads manifest.rspack.json.

Rollout

This MR is the runtime switch (ENABLE_RSPACK) that the rest of the cutover builds on:

  • Dev — gitlab-development-kit!6068 (merged) makes Rspack the default GDK bundler with zero gdk.yml changes: it exports ENABLE_RSPACK for all services and disables Vite, relying on this MR's dev-server dispatch and manifest.rspack.json selection. Verified end to end on a Vite-enabled GDK — Vite users auto-switch to Rspack, MR pages load with Rspack assets and no Vite references.
  • Production — !246320 (merged) serves Rspack-built assets behind the rspack_production_assets flag, reusing the same manifest.rspack.json mechanism added here.

Part of splitting the opt-in Rspack build (!242376 (closed)). MR1-MR3 (!243055 (merged), !243056 (merged), !243057 (merged)) are merged.

Epic: &22569 · Proposal: #604382 (closed)

Edited by Stanislav Lashmanov

Merge request reports

Loading
Loading