Skip to content

Guides - Inconsistent Bundle Sizes #1288

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

Closed
webpack-bot opened this issue Jun 13, 2017 · 1 comment
Closed

Guides - Inconsistent Bundle Sizes #1288

webpack-bot opened this issue Jun 13, 2017 · 1 comment
Labels

Comments

@webpack-bot
Copy link

Do you want to request a feature or report a bug?
Report confusion from documentation

What is the current behavior?
I'm following the link https://webpack.js.org/guides/code-splitting-libraries/
The link says that both of below are same in achieving results:

Block 1:

new webpack.optimize.CommonsChunkPlugin({
    names: ['vendor', 'manifest'] // Specify the common bundle's name.
})

and

Block 2:

  new webpack.optimize.CommonsChunkPlugin({
    name:'vendor',
    minChunks: function (module) {
      return module.context && module.context.indexOf('node_modules') !== -1; // Yes, my dependencies are in the `node_modules` directory only
    }
  }),
  new webpack.optimize.CommonsChunkPlugin({
    name: 'manifest' 
 }),

However, the results are different.
The 2nd code is further decreasing the size of bundle.js but increasing size of vendor.js as compared to 1st code.

What is the expected behavior?
Both should give same results as per the link, isn't it?

All below are minified by ungzipped

367K merchant_f635dfc7bac94b0ce269.js
797K vendor_4ecf8f4402fec3b30e21.js

Note: The above is with just with

  new webpack.optimize.CommonsChunkPlugin({
    name: 'vendor',
  }),

Block 1:

367K merchant_fdeaaf746c5086d62004.js
795K vendor_58f5a6e9a4b78c27541f.js

Block 2:

341K merchant_74101a326fd4fcb817ee.js
837K vendor_fc23737da683023356a5.js

Tested with 3 different repositories (2 react repos and 1 infernojs repo). Similar observations.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

Node: 4.8.0
Webpack: 2.5.1
OSX


This issue was moved from webpack/webpack#5057 by @sokra. Orginal issue was by @aseem2625.

@skipjack skipjack changed the title Code chunking(vendor): difference in sizes Guides - Inconsistent Bundle Sizes Jun 17, 2017
@skipjack
Copy link
Collaborator

skipjack commented Jul 1, 2017

The code-splitting-libraries guide was removed in #1338 and replaced with a simpler code-splitting guide that doesn't use these examples. If there's a similar erroneous example in the caching guide or commons-chunk-plugin, please re-open or add a comment on #652.

@skipjack skipjack closed this as completed Jul 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants