鍍金池/ 問答/HTML/ vue-cli 的app manifest vendor 這三個(gè)js 可以合并到

vue-cli 的app manifest vendor 這三個(gè)js 可以合并到一起么?

new webpack.optimize.CommonsChunkPlugin({
      name: 'vendor',
      minChunks (module) {
        // 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',
      minChunks: Infinity
    }),
    // This instance extracts shared chunks from code splitted chunks and bundles them
    // in a separate chunk, similar to the vendor chunk
    // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
    new webpack.optimize.CommonsChunkPlugin({
      name: 'app',
      async: 'vendor-async',
      children: true,
      minChunks: 3
    }),

這里好像是生成這3個(gè)文件的地方,我是否可以修改這里 然后讓這三個(gè)文件打包在一起,我想讓h5 少一點(diǎn)請(qǐng)求,因?yàn)檫@幾個(gè)文件都不是很大

回答
編輯回答
入她眼

不使用CommonsChunkPlugin可以打包在一起,但是不建議這么做,這三個(gè)js分別對(duì)應(yīng)著第三方依賴緩存包,代碼分割,使用這個(gè)插件能提高你項(xiàng)目的加載速度.雖然你打包在一次請(qǐng)求次數(shù)少了,但是請(qǐng)求也相對(duì)就大了,首屏渲染也慢!

2018年4月26日 22:23