What does “kids” mean in the CommonsChunkPlugin configuration

I am trying to wrap my head around configuration options for webpack CommonsChunkPlugin. These options include a boolean property children. Could you explain what will happen if this parameter is set to true, or when it is set to false? This documentation says: “If trueall children of the total are selected,” but the page never defines “children from the total.” "Are the children pieces that include the common piece? Or, perhaps, the modules that include the common part? Also, what are the consequences of the children’s" choice "?

+4
source share
1 answer

I think the phrase here is a little misleading. If you look at an example on the same documentation page , it will become more understandable.

Once you start with code splitting, the term chunk may refer to

  • your input fragments that have children created by the split points of your code,
  • pieces created by your split points (i.e. children of your records) or
  • part of the total volume that you merge with CommonsChunkPlugin.

, , , CommonsChunkPlugin, , . "name" CommonsChunkPlugin. , , , . , "", CommonsChunkPlugin "" "".

new webpack.optimize.CommonsChunkPlugin({
  name: 'app',
  children: true
})

"", :

new webpack.optimize.CommonsChunkPlugin({
  name: 'app',
  filename: 'common-code.js',
  children: true,
  async: true
})

true commons

"commons chunk", , "entry chunk".

+4

Source: https://habr.com/ru/post/1671268/


All Articles