Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Frontend/implementations/react/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
9 changes: 7 additions & 2 deletions Frontend/implementations/react/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -69,7 +74,7 @@ module.exports = {
},
devServer: {
static: {
directory: path.join(__dirname, '../../../SignallingWebServer/www'),
directory: path.join(__dirname, './dist'),
},
},
}
Loading