From 855702f47556b4942a3d9c9a5e928812c5a78071 Mon Sep 17 00:00:00 2001 From: mcottontensor <80377552+mcottontensor@users.noreply.github.com> Date: Tue, 5 May 2026 11:26:32 +1000 Subject: [PATCH] build(react): output bundle to its own dist/ instead of SignallingWebServer/www/ (#874) Both reference frontend implementations were writing to SignallingWebServer/www/ with `clean: true`, so a top-level `npm run build --ws` ran the TS impl first and then had its output wiped by the React impl that ran second. Wilbur was then served the React impl's minimal page (auto-connect, no UI overlay) instead of the TS reference frontend. Point the React webpack at a local dist/ directory so the two implementations no longer collide. WEBPACK_OUTPUT_PATH is honoured for symmetry with the TS impl, and the readme documents how to have Wilbur serve this bundle via --http_root. (cherry picked from commit 109624518cec2b6017e83c445c853b35dbdd0125) --- Frontend/implementations/react/readme.md | 13 +++++++++++++ Frontend/implementations/react/webpack.common.js | 9 +++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Frontend/implementations/react/readme.md b/Frontend/implementations/react/readme.md index 02e3cf98c..43c9be6a8 100644 --- a/Frontend/implementations/react/readme.md +++ b/Frontend/implementations/react/readme.md @@ -15,3 +15,16 @@ To build and run the React application, run: - `npm install` - `npm run build-all` - `npm run serve` + +### Serving via Wilbur + +Webpack outputs this bundle to `Frontend/implementations/react/dist/` (rather than `SignallingWebServer/www/`, which is reserved for the TypeScript reference frontend). To have Wilbur serve the React bundle, pass its path via `--http_root`: + +```bash +# Build the React bundle, then start Wilbur pointed at it +npm run build --workspace Frontend/implementations/react +./SignallingWebServer/platform_scripts/bash/start.sh \ + --http_root="$(pwd)/Frontend/implementations/react/dist" +``` + +If you want webpack to write somewhere else (for example, to drop the bundle directly into a deploy directory), set `WEBPACK_OUTPUT_PATH` before running the build. diff --git a/Frontend/implementations/react/webpack.common.js b/Frontend/implementations/react/webpack.common.js index ade1732a8..9d2c0416c 100644 --- a/Frontend/implementations/react/webpack.common.js +++ b/Frontend/implementations/react/webpack.common.js @@ -59,7 +59,12 @@ module.exports = { filename: '[name].js', library: 'epicgames-react-frontend', libraryTarget: 'umd', - path: path.resolve(__dirname, '../../../SignallingWebServer/www'), + // Output to a local dist/ rather than SignallingWebServer/www so this build + // doesn't clobber the TypeScript reference frontend that Wilbur serves by default. + // To have Wilbur serve this bundle, point it at dist/ via --http_root. + path: process.env.WEBPACK_OUTPUT_PATH + ? path.resolve(process.env.WEBPACK_OUTPUT_PATH) + : path.resolve(__dirname, './dist'), clean: true, globalObject: 'this', hashFunction: 'xxhash64', @@ -69,7 +74,7 @@ module.exports = { }, devServer: { static: { - directory: path.join(__dirname, '../../../SignallingWebServer/www'), + directory: path.join(__dirname, './dist'), }, }, }