-
Notifications
You must be signed in to change notification settings - Fork 864
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
Webpack bundle dependencies #2511
Webpack bundle dependencies #2511
Conversation
…need blacklisting
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.
Code review passed
Time to make another custom build...
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.
Lgtm
f684ef4
to
7d4b485
Compare
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.
build and dev worked great for me
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.
NO issue spotted after using for 1 week
Webpack bundle dependencies
Pull Request Type
Description
This pull request makes various changes to reduce FreeTube's package size. The first major one is allowing webpack to bundle the dependencies, this means that only the code that actually used is included in the final build (webpack failed to bundle both ytsr and ytpl, so for the moment they will still be included as is in the final package).
Bundling your code and dependencies is recommended by the Electron performance guidelines,
electron-builder
however defaults to packaging all non dev dependencies in the node_modules directory into your package, which blows up the package size unnecessarily.As the default behaviour of electron-builder is now undesired, I've blacklisted the entire
node_modules
folder and only whitelistedytsr
,ytpl
as well as their shared dependencyminiget
.I also added the configuration option to tell the vue compile to condense whitespace, this change only changed the bundle size by a few 10s of kb but as it's such an easy change it doesn't hurt.This got rid of whitespace that we actually need, so I got rid of that option.The final change was to import the icons we need from the fontawesome solid icons icon pack, instead of importing the whole pack. This allows webpack to only bundle the icons we need instead of bundling all of them. This reduced the size of
renderer.js
file by another 0.6MB (now1.93MB1.96MB).All in all the changes resulted in the
app.asar
file now only being6.51MB6.53MB big (down from 36.6MB). We can probably make it even smaller but that's something for future me to tackle.Some ideas that I've got are minimising the CSS (would require us to add a load more development dependencies though, thanks CssMinimizerWebpackPlugin), miminising the static JSON files and only packaging MacOS icons in MacOS builds, the same for the Windows ones.
Screenshots (if appropriate)
Before:
After:
see new screenshot in comment below
Testing (for code that is not small enough to be easily understandable)
I tested both development
yarn dev
and production buildsyarn build
. I also backed up and nuked my FreeTube user data to make sure no cached files were being used.Desktop (please complete the following information):