Skip to content

Conversation

@mcottontensor
Copy link
Collaborator

Relevant components:

  • Signalling server
  • Common library
  • Frontend library
  • Frontend UI library
  • Matchmaker
  • Platform scripts
  • SFU

Problem statement:

The platform scripts have been problematic for a while, causing multiple builds of the same package, slow startup and failed startups.

Solution

Have gone over the windows and linux scripts and made sure they are focused on what needs to be built and only building that. The usage text has also been updated to properly reflect the options.

@changeset-bot
Copy link

changeset-bot bot commented Apr 3, 2025

⚠️ No Changeset found

Latest commit: 1bb21da

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@lukehb lukehb changed the title Platfirm scripts audit Platform scripts audit Apr 4, 2025
Copy link
Contributor

@lukehb lukehb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to give this a local test on my workspace, I'll report back. It works well! I have some left some feedback below on a fix things to consider.

@lukehb
Copy link
Contributor

lukehb commented Apr 4, 2025

As an aside, I found when testing this that webpack building umd reference frontend it will selectively use either the /dist/cjs or dist/esm output of each of the packages depending which one exists on disk, with a preference for esm.

In terms of the final bundle that is produced in these two outcomes (deps being either all cjs or all esm) the bundle size is very similar.

Building the dev bundle is about 2.4mb on disk vs prod which is 370kb. (As an additional note when I reviewed the GH releases our bundle size does seem to have grown by about 100kb since October last year for no reason? - Maybe we should use: https://www.npmjs.com/package/webpack-bundle-analyzer )

The reason I mention the bundle size is it fine for start.bat to use larger dev bundle imo, but the GH release ships should prod bundle (which it does not, but just mentioning this in case you make more changes to this PR).

@mcottontensor
Copy link
Collaborator Author

The reason I mention the bundle size is it fine for start.bat to use larger dev bundle imo, but the GH release ships should prod bundle (which it does not, but just mentioning this in case you make more changes to this PR).

Looking at the release action it uses the build npm script which calls webpack with the prod configuration?

@lukehb
Copy link
Contributor

lukehb commented Apr 8, 2025

The reason I mention the bundle size is it fine for start.bat to use larger dev bundle imo, but the GH release ships should prod bundle (which it does not, but just mentioning this in case you make more changes to this PR).

Looking at the release action it uses the build npm script which calls webpack with the prod configuration?

Quite right! Just ignore that bit then. I still think the growth in bundle size is interesting and should be looked into in a new ticket/PR. But is certainly not a blocker for this one.

Copy link
Contributor

@lukehb lukehb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some rfc

"build": "npx webpack --config webpack.prod.js",
"build:dev": "npx webpack --config webpack.dev.js",
"build:esm": "npx webpack --config webpack.esmodule.js",
"build:cjs": "npx webpack --config webpack.common.js",
Copy link
Contributor

@lukehb lukehb Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This a funny one actually on closer inspection.

We have the following webpack build configs for the reference frontend:

webpack.common.js - This is the base config used by both webpack.dev.js and webpack.prod.js - but perhaps confusingly named is not actually configuring webpack to build commonjs, but rather umd (which is correct considering you can't run cjs in the browser and webpack transforms the cjs deps into browser compatible umd for us). One solution to avoid this confusion is to rename this file webpack.base.js. Of additional note, because the webpack.common.js configuration does not specify a mode (development or production) webpack emits some warnings saying falling back to development etc, so this config should probably never be called directly.

webpack.dev.js - The dev configuration of the umd build (with inline source maps). This is probably the one we want the start.bat script to use.

webpack.prod.js - The prod configuration of the umd build that does minification etc so you end up with a smaller bundle.

webpack.esmodule.js - A completely different configuration that bundles into an esm module. Which could also be interesting for some usecases (like if someone is an all ESM codebase), but probably umd is the one we and most users will want to use.

Suggested change
"build:cjs": "npx webpack --config webpack.common.js",
"build:prod": "npx webpack --config webpack.prod.js",

pushd "${SCRIPT_DIR}/../../../Frontend/implementations/typescript" > /dev/null
"${SCRIPT_DIR}/node/bin/npm" install
"${SCRIPT_DIR}/node/bin/npm" run build
"${NPM}" run build:cjs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"${NPM}" run build:cjs
"${NPM}" run build:dev

pushd %CD%\Frontend\implementations\typescript
call "%SCRIPT_DIR%node\npm" install
call "%SCRIPT_DIR%node\npm" run build
call %NPM% run build:cjs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
call %NPM% run build:cjs
call %NPM% run build:dev

@mcottontensor mcottontensor added auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5 labels Apr 8, 2025
@mcottontensor mcottontensor merged commit f7abd33 into EpicGamesExt:master Apr 8, 2025
8 checks passed
@mcottontensor mcottontensor deleted the scripts_fix branch April 8, 2025 05:07
github-actions bot pushed a commit that referenced this pull request Apr 8, 2025
* Limited the bash script to build cjs
* Added a cjs build target
* Updating bash script to be a little more friendly with builds.
* Added rebuild options to bash script
* Updating windows batch script to be inline with bash script.
* Cleaned up arguments further for the bash script
* Tweaking build behaviour. Updating args
* Sorting out webpack configs

(cherry picked from commit f7abd33)
@github-actions
Copy link
Contributor

github-actions bot commented Apr 8, 2025

💚 All backports created successfully

Status Branch Result
UE5.5

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

mcottontensor added a commit that referenced this pull request Apr 8, 2025
* Limited the bash script to build cjs
* Added a cjs build target
* Updating bash script to be a little more friendly with builds.
* Added rebuild options to bash script
* Updating windows batch script to be inline with bash script.
* Cleaned up arguments further for the bash script
* Tweaking build behaviour. Updating args
* Sorting out webpack configs

(cherry picked from commit f7abd33)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>
mcottontensor added a commit that referenced this pull request Apr 8, 2025
* Action audit (#565) (#566)

- Removing duplicated push and pull_request triggers
- Removing multiple install commands when one root will work.
- Removing references to UE5.5 in favor of wildcard matching

(cherry picked from commit 4ee5695)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>

* [UE5.5] Moved frontend library from a peer dep to a normal dep in ui-library (#568) (#569)

* Moved frontend library from a peer dep to a normal dep in ui-library (#568)

(cherry picked from commit e255bc0)

# Conflicts:
#	Frontend/ui-library/package.json
#	package-lock.json

* Fixing package-lock issues

* Fixing issue where workspace path doesnt exist in npm publish action (#570) (#571)

Trying to also fix issues with the changelog update perms.

(cherry picked from commit 4f9b8a7)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>

* Trying to fix changelog update action

* Still trying to fix changeset update action

* What a nightmare

* Updated NPM changelogs (#572)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fixing publish action.

* Fixing publish action more.

* Wrong package file.

* Fix: Various input issues with input into streamed UE widgets (including IME support) (#564) (#575)

* Add stub of editTextModal to application
* Added events for showing onscreen keyboard, hooked them up to an edit text modal
* Added explicitly stopping event propogation on text input into stream UI bleeding into UE keyboard input
* Added hidden text box input for desktop IME use
* Added config option to not show the modal
* Added new docs page about typing into streamed inputs
* Remove oncomposition event from keyboard controller as they were only needed for IME input which is now handled via modal
* Removed now unused styles from PixelStreamingApplicationStyles.ts
* Update Typing into streamed text inputs.md
Mentioned the use of software cursor as an option.
---------

Co-authored-by: Matthew.Cotton <matt@tensorworks.com.au>
(cherry picked from commit 5fb6eb6)

Co-authored-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>

* Platform scripts audit (#567) (#577)

* Limited the bash script to build cjs
* Added a cjs build target
* Updating bash script to be a little more friendly with builds.
* Added rebuild options to bash script
* Updating windows batch script to be inline with bash script.
* Cleaned up arguments further for the bash script
* Tweaking build behaviour. Updating args
* Sorting out webpack configs

(cherry picked from commit f7abd33)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>

* Updated NPM changelogs (#576)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>
mcottontensor added a commit that referenced this pull request Apr 8, 2025
* Action audit (#565) (#566)

- Removing duplicated push and pull_request triggers
- Removing multiple install commands when one root will work.
- Removing references to UE5.5 in favor of wildcard matching

(cherry picked from commit 4ee5695)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>

* [UE5.5] Moved frontend library from a peer dep to a normal dep in ui-library (#568) (#569)

* Moved frontend library from a peer dep to a normal dep in ui-library (#568)

(cherry picked from commit e255bc0)

# Conflicts:
#	Frontend/ui-library/package.json
#	package-lock.json

* Fixing package-lock issues

* Fixing issue where workspace path doesnt exist in npm publish action (#570) (#571)

Trying to also fix issues with the changelog update perms.

(cherry picked from commit 4f9b8a7)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>

* Trying to fix changelog update action

* Still trying to fix changeset update action

* What a nightmare

* Updated NPM changelogs (#572)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fixing publish action.

* Fixing publish action more.

* Wrong package file.

* Fix: Various input issues with input into streamed UE widgets (including IME support) (#564) (#575)

* Add stub of editTextModal to application
* Added events for showing onscreen keyboard, hooked them up to an edit text modal
* Added explicitly stopping event propogation on text input into stream UI bleeding into UE keyboard input
* Added hidden text box input for desktop IME use
* Added config option to not show the modal
* Added new docs page about typing into streamed inputs
* Remove oncomposition event from keyboard controller as they were only needed for IME input which is now handled via modal
* Removed now unused styles from PixelStreamingApplicationStyles.ts
* Update Typing into streamed text inputs.md
Mentioned the use of software cursor as an option.
---------

Co-authored-by: Matthew.Cotton <matt@tensorworks.com.au>
(cherry picked from commit 5fb6eb6)

Co-authored-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>

* Platform scripts audit (#567) (#577)

* Limited the bash script to build cjs
* Added a cjs build target
* Updating bash script to be a little more friendly with builds.
* Added rebuild options to bash script
* Updating windows batch script to be inline with bash script.
* Cleaned up arguments further for the bash script
* Tweaking build behaviour. Updating args
* Sorting out webpack configs

(cherry picked from commit f7abd33)

Co-authored-by: mcottontensor <80377552+mcottontensor@users.noreply.github.com>

* Updated NPM changelogs (#576)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Rebuilt package-lock

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Luke Bermingham <1215582+lukehb@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Used to specify we want a PR to auto backport to a branch, must be paired with auto-backport-to-UEX. auto-backport-to-UE5.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants