码迷,mamicode.com
首页 > 其他好文 > 详细

cookingk配置项中的chunk:true含义

时间:2016-10-06 06:59:36      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:

学习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含义

标签:

原文地址:http://www.cnblogs.com/yangfengitblog/p/5933333.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!