Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate webpack workflow into development and production for the library and typescript example packages #25

Merged
merged 27 commits into from
Apr 4, 2023

Conversation

adrianZahra
Copy link
Contributor

Relevant components:

  • Scalable Pixel Streaming Frontend library
  • Examples
  • Docs

Problem statement:

The problem that this PR aims to solve is the need to split out the webpack.config.js files in the example and library. This is required as currently webpack is adding features in production builds of the frontend that are not required and not wanted for production building.

Solution

This PR solves the issue by splitting out the old webpack files for the library and example into webpack.dev, webpack.prod and webpack.common files. This allows us to make dev and prod builds of the library and example. Dev builds will include things like enabling the source map for debugging and prod builds help by minimizing code and only include the most nessecary files in builds.

Documentation

Documentation for this is to be constructed at this point in time and will be addressed in Updating Frontend Docs for 1.0.0#229

Test Plan and Compatibility

To make use of this new functionality the following commands can be run from ./examples/typescript
build the library and example with dev settings npm run build-all-dev
build the library and example with production settings npm run build-all-prod
link the library to the example npm run symlink
run the example for development once all is build npm run serve **this will run with development mode

To make use of this new functionality with the library the following commands can be run from ./library
to build the library in dev mode npm run build-dev
to build the library in production mode npm run build-prod

Copy link
Collaborator

@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.

Left some minor comments and questions.

Copy link
Collaborator

@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.

Take this more as an idea, but I think it could be cool:

When a PR is initiated it does a build of dev and prod of the lib as a validation that the PR didn't break library building.

wdyt @dan-tw ?

edit: I mention this here because if the team agrees it is cool, this PR could be the one that introduces that potentially.

@dan-tw
Copy link
Contributor

dan-tw commented Mar 29, 2023

https://github.com/ScalablePixelStreaming/Frontend/blob/v1.0.0/.github/workflows/test-pull-request.yaml

This workflow does that, perhaps it needs updating to also run the new dev/prod build scripts as well

I would do dev/prod build for lib and dev/prod build for the example (4 checks in total) .. that way we can get a more fine-grained understanding of where something might be broken (e.g. dev/prod lib/frontend)

@adrianZahra
Copy link
Contributor Author

The pull request test has been updated in 86ddce5

Copy link
Contributor

@dan-tw dan-tw left a comment

Choose a reason for hiding this comment

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

Ensure that we are using WEBSOCKET_URL in the code if the .env file is used. I can't see anywhere that this variable is actually being consumed.

@adrianZahra
Copy link
Contributor Author

I have tested the env file and updated the process and usage as it was broken da665f8

@adrianZahra adrianZahra changed the title Adding new webpack file for Library and Example Adding new Dev and Prod webpack files for Library and Example Mar 30, 2023
@dan-tw dan-tw merged commit 4c61a01 into ScalablePixelStreaming:v1.0.0 Apr 4, 2023
@dan-tw dan-tw changed the title Adding new Dev and Prod webpack files for Library and Example Separate webpack workflow into development and production for the library and typescript example packages Apr 4, 2023
@dan-tw dan-tw linked an issue Apr 4, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No separate development/production webpack configurations for DOM delegate
4 participants