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

Upgrade webpack and related packages #392

Merged
merged 1 commit into from
May 13, 2019
Merged

Upgrade webpack and related packages #392

merged 1 commit into from
May 13, 2019

Conversation

foolip
Copy link
Member

@foolip foolip commented May 12, 2019

The mode option needs to be added to webpack config:
https://webpack.js.org/migrate/4#mode

CommonsChunkPlugin is replaced by new config:
https://webpack.js.org/migrate/4#commonschunkplugin
https://webpack.js.org/configuration/optimization/#optimizationsplitchunks

CleanWebpackPlugin uses webpack's output.path by default, so use the
default configuration:
johnagan/clean-webpack-plugin#106

UglifyjsWebpackPlugin is replaced with TerserWebpackPlugin, which is
now webpack's default minimizer:
https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions
webpack/webpack#8036

Unfortunately karma-webpack 4.0.0 isn't released yet, so a release
candidate is used instead.

@foolip
Copy link
Member Author

foolip commented May 13, 2019

The total bundle size is made slightly smaller by this:

$ ls -sh old-static/bundle/ static/bundle/
old-static/bundle/:
total 2.7M
104K app.bundle.js  692K foam.bundle.js  1.9M vendors.bundle.js   44K worker.es6.bundle.js

static/bundle/:
total 2.3M
104K app.bundle.js  696K foam.bundle.js  1.5M vendors.bundle.js   44K worker.es6.bundle.js

I suspect that a lot of vendors.bundle.js is unused code, but I won't change that in this PR.

minChunks: function(module) {
return module.context && module.context.indexOf('node_modules') !== -1;
optimization: {
splitChunks: {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is from https://webpack.js.org/plugins/split-chunks-plugin/#split-chunks-example-2 and I think it's equivalent to the original config.

The `mode` option needs to be added to webpack config:
https://webpack.js.org/migrate/4#mode

CommonsChunkPlugin is replaced by new config:
https://webpack.js.org/migrate/4#commonschunkplugin
https://webpack.js.org/configuration/optimization/#optimizationsplitchunks
https://webpack.js.org/plugins/split-chunks-plugin/#split-chunks-example-2

CleanWebpackPlugin uses webpack's `output.path` by default, so use the
default configuration:
johnagan/clean-webpack-plugin#106

UglifyjsWebpackPlugin is replaced with TerserWebpackPlugin, which is
now webpack's default minimizer:
https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions
webpack/webpack#8036

Unfortunately karma-webpack 4.0.0 isn't released yet, so a release
candidate is used instead.
@codecov-io
Copy link

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #392   +/-   ##
=======================================
  Coverage   60.77%   60.77%           
=======================================
  Files          54       54           
  Lines        2904     2904           
=======================================
  Hits         1765     1765           
  Misses       1139     1139

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 f2513d3...8acbeef. Read the comment docs.

@foolip
Copy link
Member Author

foolip commented May 13, 2019

@foolip
Copy link
Member Author

foolip commented May 13, 2019

Tested manually, seems fine.

@foolip foolip requested a review from Hexcles May 13, 2019 11:40
@foolip foolip mentioned this pull request May 13, 2019
Copy link
Contributor

@Hexcles Hexcles left a comment

Choose a reason for hiding this comment

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

LGTM (not really familiar with Webpack though)

@foolip
Copy link
Member Author

foolip commented May 13, 2019

Neither am I, the commit message is all that I learned trying to fix this :)

@foolip foolip merged commit 11dee23 into master May 13, 2019
@foolip foolip deleted the webpack branch May 13, 2019 20:30
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.

3 participants