Repository navigation
Migrate welcome webapp from Create React App to Vite - #22
Merged
Merged
Conversation
xtclang/xvm#561 moved generated xunit test modules from a shared /tmp/xunit into each project's build directory, so the --max-workers=1 workaround is no longer needed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
welcomewebapp was built with Create React App (react-scripts5.0.1). CRA is deprecated and 5.0.1 is its final release. Its pinned transitive dependencies caused the npm deprecation warnings in the CI log (svgo@1.3.2,source-map-resolve@0.6.0) and all 80npm auditfindings (6 critical, 37 high). Updating dependency versions can't remove them, so this PR replaces CRA with Vite, the replacement the React docs recommend.Changes
package.json:react-scriptsreplaced byvite8.3.1 and@vitejs/plugin-react6.1.1. React 18 → 19.3. Scripts are nowdev/build/preview; Gradle still callsnpm run build.public/index.htmlmoved towebapp/index.html, the Vite entry point, with an explicit<script type="module" src="/src/index.jsx">.%PUBLIC_URL%references replaced by/; the app is served at/, so the resulting URLs are the same.App.js/index.jsrenamed to.jsx(Vite only treats.jsxfiles as JSX). No code changes.vite.config.jswithoutDir: 'build', sowelcome.x(@StaticContent("/", /build)) and thebuildWebappoutput inwebapp-conventionsstay unchanged.webapp-conventions.gradle.kts:index.htmlandvite.config.jsadded asbuildWebappinputs, so editing either triggers a rebuild.src/App.test.js: CRA boilerplate that looked for "learn react", text the app doesn't render. Nothing ever ran it.web-vitalsdependencies.web-vitalswasn't imported anywhere.eslintConfig/browserslistsettings, which only CRA read.Result: the npm install drops from ~1,400 packages to 19, prints no deprecation warnings, and
npm auditreports 0 vulnerabilities. The lockfile was regenerated with npm 11.6.2, the version the build pins.Verification
./gradlew clean, then./gradlew build installDist :welcome:runXtc --warning-mode=all --max-workers=1 --no-build-cache: BUILD SUCCESSFUL. No npm warnings in the webapp build.End-to-end on the XQIZ.IT platform (built from
xtclang/platformmaster), comparing master (CRA) with this branch (Vite). Both builds were uploaded aswelcome.examples.organd deployed aswelcome. Headless Chrome loadedhttps://welcome.localhost.xqiz.it/for each./static/js/main.*.js,/static/css/main.*.css)/assets/index-*.js,/assets/index-*.css)/welcome/org,/welcome/info,/welcome/countCI's
:welcome:runXtcstep only runswelcomeTest, the database console app. Nothing in CI loads this page, so the platform run above is the only check that the page itself works.Differences in the
build/outputassets/instead ofstatic/js/static/css. The generatedindex.htmlreferences them with absolute paths, as before.asset-manifest.json(CRA-specific) is no longer generated; nothing in the repo refers to it.public/manifest.jsonstill has CRA's sample name ("Create React App Sample"). Left as is to keep this PR focused.Measured impact of the migration
node_modulessize (local)npm audit:welcome:npmInstall:welcome:buildWebappnpm ci+ buildThe CI numbers come from Gradle task timestamps in the last master run and this PR's first run. The webapp used to take about 31 s of the "Build & test" job and now takes about 2.5 s. The whole job took 4m55s on this PR's first run versus 8–9 min on master, but most of that difference is Gradle build-cache hits: 3 of the 7
testXtctasks were restored from cache, so 174 xunit tests ran instead of 280. Don't read that job time as a gain from the migration.Why so few packages
react-scriptsinstalled every tool a CRA project might use, whether this app used it or not: webpack plus its dev server, Babel with dozens of plugins, Jest with jsdom, ESLint with its plugins, PostCSS, workbox and svgo. Each of those is made of many small JavaScript packages. Vite 8 does its bundling with Rolldown (Rust) and CSS processing with Lightning CSS, and each arrives as one precompiled binary package for the platform. There's also no test runner, linter or offline-support tool left to install, because this app doesn't use them.The full install is
react,react-domandscheduler; thenvite,@vitejs/plugin-react,rolldownplus its native binding and helpers, and@oxc-project/types; thenlightningcssplus its native binding andpostcss; and a handful of small utilities (nanoid,picocolors,picomatch,fdir,tinyglobby,source-map-js,detect-libc). The lockfile has 19 packages; the exact count installed varies by OS because of platform-specific packages (21 on CI's Linux runner, 20 on macOS).CI: parallel Gradle workers
This PR also removes the
--max-workers=1added in #20. The workaround was needed because the XTC xunit engine generated test modules into a single shared/tmp/xunit. xtclang/xvm#561 (merged 2026-08-31) moved them into each project'sbuild/xunit/modules, and CI already runs with that fix: its logs showXUnit: Creating test module … in chess-game/app/build/xunit/modules.Without the flag, Gradle uses one worker per CPU core. That's 4 on the standard GitHub-hosted runner for public repos, and
org.gradle.parallel=trueis already set ingradle.properties.Local stress test: full
build --rerun-tasks --no-build-cacheruns on a 10-core Mac./tmp/xunit.