-
Notifications
You must be signed in to change notification settings - Fork 262
Conversation
… the libraries as dependencies
"types": "types/pixelstreamingfrontend.d.ts", | ||
"sideEffects": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just promises that our library does not do any side effects when the library is imported. All the effects are done through direct calls, not just by importing. This allows the tree shaking mechanisms to drop any library code that isn't referenced.
"jss": "^10.9.2", | ||
"jss-plugin-camel-case": "^10.9.2", | ||
"jss-plugin-global": "^10.9.2" | ||
}, | ||
"peerDependencies": { | ||
"@epicgames-ps/lib-pixelstreamingfrontend-ue5.2": "0.1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Require library
as a peer dependency provided through the implementation application dependencies, not as a transitive dependency through ui-library
. This might prevent us from having two distinct versions as dependencies in the final build, one from direct dependency, one through ui-lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Landing.
Bring smaller bundle size fix to 5.2 (#117)
Summary
This PR makes the build bundle sizes smaller. There were a couple of issues that increased the size of both the final implementation
player.js
build size and the size of the library JS packages. The main issue was that thelibrary
code was included twice in the JS packages.Bundle size of
library
andui-library
The library builds bundled all their external and internal dependencies within the
dist/*.js
package.externals
section in library Webpack buildsdist/*.js
size reductions:library
128kB -> 118kBui-library
217kB -> 67kB (previously bundled alsolibrary
within the JS in addition to the external dependencies)Bundle size of
player.js
The build pipeline bundled two versions of the library code into the final package. This could be seen by opening and investigating the final
player.js
, which had two versions of the library code.library
were added to the bundleimplementation/EpicGames
linked locally to it vianpm link ../library
ui-library
ended up using the NPM version when the final build was made. Reasons:npm ci
afternpm link
overwrites the linknpm link ../library
inui-library
, but then runningnpm link ../../ui-library
inEpicGames
resets the linking inui-library
. The links need to be set up in opposite order if both need to be preserved: first inEpicGames
, then inui-library
.Exporting ESM modules
The library modules were exported as
umd
modules, which isn't tree-shakeable.esm
module build in addition toumd
esm
module is provided in package.jsonmodule
andumd
in package.jsonmain
. Dependency users are automatically able to choose which ones to use