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

Optimize build speed #948

Merged
merged 3 commits into from
Sep 3, 2020

Conversation

Hyperkid123
Copy link
Contributor

This PR introduces some changes to the webpack build process in order to improve the build speed.

Build time changes

command time no cache time cache
build 68s 33s
build:js 60s 28s

Watch results
The initial build takes around 28s. After that, the watch mode re-builds the bundle in a couple of seconds. We no longer have to wait for 20+ s in watch mode after each change.

Changes

  • removed hard minimize:true from webpack config
    • this was causing that even dev version of the build was minimizing the code which lead to very long build times
    • minimize property is now based on the mode argument that is passed via npm scripts
  • use TerserWebpack plugin as minimizer
    • this is one of the most performant webpack minimizers
    • minimizing is done in parallel and these time savings
    • should be building better source maps ™️
  • use HardSourceWebpackPlugin cache
    • this should be included by default in webpack 5
    • the cache significantly speeds up the watch build
    • we should probably set up Travis to store and read this cache to improve the CI speed we can do that later @karelhala @ryelo what do you think about that?

@codecov-commenter
Copy link

Codecov Report

Merging #948 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #948   +/-   ##
=======================================
  Coverage   52.21%   52.21%           
=======================================
  Files          53       53           
  Lines        1038     1038           
  Branches      211      211           
=======================================
  Hits          542      542           
  Misses        396      396           
  Partials      100      100           

Copy link
Contributor

@karelhala karelhala left a comment

Choose a reason for hiding this comment

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

Trying the watch mode and it's blazingly fast! Thank you!

@karelhala karelhala merged commit 6d60bd4 into RedHatInsights:master Sep 3, 2020
@Hyperkid123 Hyperkid123 deleted the iptimize-build-speed branch September 3, 2020 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants