首页 > 代码库 > cookingk配置项中的chunk:true含义

cookingk配置项中的chunk:true含义

学习cooking,查看中文文档,发现有个配置chunk: true, 不明白具体含义,于是根据注释,找到了相关代码,

即chunk: true等同于以下代码:

var webpackConfig = merge(baseWebpackConfig, {  //...  plugins: [    // split vendor js into its own file    new webpack.optimize.CommonsChunkPlugin({      name: ‘vendor‘,      minChunks: function (module, count) {        // any required modules inside node_modules are extracted to vendor        return (          module.resource &&          /\.js$/.test(module.resource) &&          module.resource.indexOf(            path.join(__dirname, ‘../node_modules‘)          ) === 0        )      }    }),    // extract webpack runtime and module manifest to its own file in order to    // prevent vendor hash from being updated whenever app bundle is updated    new webpack.optimize.CommonsChunkPlugin({      name: ‘manifest‘,      chunks: [‘vendor‘]    })  ]})

也就是两个webpack插件:CommonsChunkPlugin,CommonsChunkPlugin及默认配置

cookingk配置项中的chunk:true含义