Draft: Add opt-in Rspack frontend build (Webpack alternative)
What
Adds an opt-in Rspack frontend build as an alternative to Webpack. Disabled by
default — Webpack stays the default bundler. Selected via ENABLE_RSPACK (builds)
and DEV_SERVER_BUNDLER=rspack (dev server). Compiled output is namespaced by
bundler, so Rspack and Webpack never share assets, the CI cache key, or the
assets image tag.
How to launch
Dev mode (GDK)
Run the dev server in Rspack mode (Rails proxies /assets/webpack/* to it; lazy
compilation + HMR work):
DEV_SERVER_BUNDLER=rspack yarn dev-server
# or, via the GDK service: set DEV_SERVER_BUNDLER=rspack for the webpack service, then `gdk restart webpack`Prod mode (static build)
ENABLE_RSPACK=true NODE_ENV=production yarn build # equivalently: yarn rspack-prodEmits minified, content-hashed, gzip-compressed bundles + sourcemaps to
public/assets/webpack/. To serve them through GDK instead of the dev server:
gdk config set webpack.enabled false (revert with true + gdk reconfigure).
CI
Set ENABLE_RSPACK to true as a pipeline variable via the Run pipeline UI,
or commit it in .gitlab-ci.yml. The asset-compile jobs build with Rspack;
Webpack-only jobs (webpack-dev-server memory test, bundle-size-review) are
skipped automatically.
Note for Vite users
Some developers currently run the frontend via Vite (gdk config set vite.enabled true). Rspack is an independent alternative to Webpack — enable
either Rspack or Vite, not both. Disable Vite before switching to Rspack.
Verification
Sanity-checked locally in a real browser against GDK:
- Dev: Rspack dev server — all assets
200, lazy compilation + HMR working, no console errors. - Prod: static build served by Rails — minified/hashed/gzipped assets, no console errors, renders correctly.
Status
Opt-in and flag-gated; Webpack remains the default. Not yet production-ready —
open items: pin Rspack off the 2.1.0-rc.0 release candidate, add CI coverage
that runs with ENABLE_RSPACK=true, and verify node_modules transpilation
parity (@sentry/@radix-ui/swagger) plus Monaco worker loading.