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

Update webpack bundle configuration #5983

Merged
merged 8 commits into from
Sep 27, 2018
Merged

Conversation

kristw
Copy link
Contributor

@kristw kristw commented Sep 27, 2018

  • Add flags to enable speed measurement and bundle analyzer
npm run build -- --measure=true --analyzeBundle=true
  • Update dependency versions (css-loader, webpack-cli)

  • Remove json-loader which is not necessary for webpack 4

  • Switch from default UglifyjsPlugin to TerserPlugin as minimizer. The TerserPlugin use an updated fork of uglifyjs-es under the hood while UglifyjsPlugin use uglifyjs version 3 which does not support es module. This let us enable parallel and cache options for some speed up in the build.

  • After analyzing the bundles, define a special chunk called vendors-major for brace, core-js and react-dom which takes large portion of the three main entry points (dashboard, explore and sqllab). This will enable better caching and reduce size of the entry points. Somehow these modules were not automatically split into the common chunks as expected from default behavior.

  • Total bundle size (in assets/dist directory) goes down from 14.9MB to 12.9MB

Before
pasted_image_9_26_18__5_25_pm

After
pasted_image_9_26_18__5_23_pm

@williaster @xtinec @conglei

@codecov-io
Copy link

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5983   +/-   ##
=======================================
  Coverage   63.56%   63.56%           
=======================================
  Files         393      393           
  Lines       23667    23667           
  Branches     2638     2638           
=======================================
  Hits        15044    15044           
  Misses       8610     8610           
  Partials       13       13

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52033cb...ee3fb2c. Read the comment docs.

@mistercrunch
Copy link
Member

This is great.
LGTM

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

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

amazing! LGTM

@williaster williaster merged commit bf9a102 into apache:master Sep 27, 2018
@kristw kristw deleted the kristw-uglify branch September 27, 2018 21:20
betodealmeida pushed a commit to lyft/incubator-superset that referenced this pull request Oct 12, 2018
* add configuration for optimizing webpack

* resolve webpack cli issue

* Update outdated packages

* extract brace as its own chunk

* update comments

* add list of libs to skip parsing

* remove some libs from list

* remove noParse
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants