Switch the main application build from webpack to Vite (Vite prep 5/N)#856
Switch the main application build from webpack to Vite (Vite prep 5/N)#856dtinth-claw[bot] wants to merge 3 commits into
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #856 +/- ##
=======================================
Coverage 95.54% 95.54%
=======================================
Files 39 39
Lines 673 673
Branches 65 65
=======================================
Hits 643 643
Misses 15 15
Partials 15 15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🔎 Preview deploy for this PR: https://previews.bemuse.ninja/pr-856/index.html Updated for commit |
|
Flip the app's build tool to Vite, the culmination of the vite-prep series. - `build` → `vite build` (webpack kept as `build:webpack`); `dev` → `vite`; `rush dev` points at the Vite dev server. - `bemuse/vite.config.ts`: pug/pegjs/JSX-in-.js transforms, SSI include for index.html, node polyfills (process/Buffer/util/...), scss loadPaths, PWA (workbox) mirroring the old ServiceWorkerPlugin, and CJS interop for the linked workspace packages. - Replace webpack-only constructs: `require.context` → `import.meta.glob` (playground + spec loader), `module.hot` → `import.meta.hot`, the val-loader version/config injection → Vite `define` (__BEMUSE_VERSION__ etc.), and the dynamic `require()` in game-launcher → `await import()`. - In-browser test suite runs under Vite via `?mode=test`; `rushx test` drives it headlessly (scripts/run-browser-tests.mjs) and CI runs it. - Generate the committed pegjs parser as an ES module (`export default`) so it resolves natively under Vite/Rollup without commonjs interop. The pre-deploy "boot script inlined" gate is temporarily non-blocking (the entry is now a hashed ES module); it will be reinstated when the deploy pipeline is ported. Verified: vite build, typecheck, in-browser tests (310 passed / 1 pending), and the full e2e suite (15 passed / 1 skipped). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Wv1XChhvMw5LwiVDv3NWh
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Wv1XChhvMw5LwiVDv3NWh
SonarCloud flagged the bare Array.prototype.sort() (default sort is by UTF-16 code unit, not locale-aware) as a reliability bug. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014Wv1XChhvMw5LwiVDv3NWh



What
The Vite switch — 5/N of the piecewise migration. Prep PRs 1–4 removed the source's webpack-specific assumptions; this one flips the actual build tool.
build→vite build(webpack preserved asbuild:webpack),dev→vite, andrush devnow points at the Vite dev server.bemuse/vite.config.ts(new): pug (.jade), pegjs, and JSX-in-.jstransforms; an SSI<!--#include-->plugin forindex.html; node polyfills (process/Buffer/util/…); scssloadPaths; aVitePWA/workbox config mirroring the oldServiceWorkerPlugin; and CommonJS interop for the linked workspace packages (bms,bemuse-notechart, …).require.context→import.meta.glob(devtools/playground.js,test/loadSpecs.js)module.hot→import.meta.hotval-loader!version/scoreboard injection → Vitedefine(__BEMUSE_VERSION__,__SCOREBOARD_SERVER__)require('…/game-loader')→await import(…)?mode=testMocha suite runs under Vite;rushx testdrives it headlessly (scripts/run-browser-tests.mjs) and CI runs it.bin/build-parser.jsnow emits an ES module (export default …) instead of CommonJS, so the committedparser.jsresolves natively under Rollup without commonjs interop. (The tidy staleness check regenerates identical output.)Not in this PR (follow-ups)
continue-on-error— the Vite entry is a hashed ES module, not an inlined<script>. Reinstating the deploy pipeline for Vite is the next PR.build:webpack, theconfig/webpack*.js, karma) once we've lived on Vite for a bit.Verification (Node 24)
rushx build(vite) → green; PWA precache generated.rushx typecheck→ green.rushx test(?mode=test, headless) → 310 passed, 1 pending, 0 failed.build-scripts build:dist→ 604 files, no collisions.dist→ 15 passed, 1 skipped.Opening as a draft — it's a large, atomic switch. Happy to split further (e.g. peel the
?mode=testrunner or the parser-format change into their own PRs) if that's easier to review.🤖 Generated with Claude Code
https://claude.ai/code/session_014Wv1XChhvMw5LwiVDv3NWh