Can someone explain Webpack's CommonsChunkPlugin
I get the general gist that the So, let's assume I have the following configuration:
If I bundle without using
|
|
For case 1 I think you should specify the minChunks property. – Marko Sep 19 at 16:19
|
This is how the CommonsChunkPlugin works. A common chunk "receives" the modules shared by several entry chunk. A good example of a complex configuration can be found in the WebPack repository. The CommonsChunkPlugin is run during the optimization phase of WebPack, which means that it operates in memory, just before the chunk are sealed and written on the disk. Where several common chunks are defined, they are processed in order. In your case 3, it is like running the plugin twice. But please note that the CommonsChunkPlugin can have a more complex configuration (minSize, minChunks, etc) that impacts the way modules are moved. CASE 1:
CASE 2:
CASE 3:
Hope it helps. |
http://stackoverflow.com/questions/39548175/can-someone-explain-webpacks-commonschunkplugin/39600793
Can someone explain Webpack's CommonsChunkPlugin的更多相关文章
- 关于webpack.optimize.CommonsChunkPlugin的使用二
Note:当有多个入口节点的时候,只有所有入口节点都引入了同一个模块的时候,webpack.optimize.CommonsChunkPlugin才会将那个模块提取出来,如果其中一个入口节点没有引入该 ...
- webpack.optimize.CommonsChunkPlugin插件的使用
方式一,传入字符串参数 new webpack.optimize.CommonsChunkPlugin('common.js'), // 默认会把所有入口节点的公共代码提取出来,生成一个common. ...
- [转] 用webpack的CommonsChunkPlugin提取公共代码的3种方式
方式一,传入字符串参数 new webpack.optimize.CommonsChunkPlugin(‘common.js’), // 默认会把所有入口节点的公共代码提取出来,生成一个common. ...
- 详解用webpack的CommonsChunkPlugin提取公共代码的3种方式(注意webpack4.0版本已不存在)
Webpack 的 CommonsChunkPlugin 插件,负责将多次被使用的 JS 模块打包在一起. CommonsChunkPlugin 能解决的问题 在使用插件前,考虑几个问题: 对哪些 c ...
- webpack关于CommonsChunkPlugin在高版本被移除的替代方案问题
1.在指南的缓存章节里webpack.config.js文件中,使用new的方法会报错 const webpack = require('webpack'); + new webpack.optimi ...
- 使用webpack.optimize.CommonsChunkPlugin提供公共代码
在webpack4里使用webpack.optimize.CommonsChunkPlugin时,报错,webpack4删除了常用的 CommonsChunkPlugin ,提示我们用config.o ...
- webpack.optimize.CommonsChunkPlugin
打包第三方控件:比如jquery,angular,bootstrap.... const CommonsChunkPlugin = require("webpack/lib/optimize ...
- [Webpack 2] Chunking common modules from multiple apps with the Webpack CommonsChunkPlugin
If you have a multi-page application (as opposed to a single page app), you’re likely sharing module ...
- [Webpack 2] Grouping vendor files with the Webpack CommonsChunkPlugin
Often, you have dependencies which you rarely change. In these cases, you can leverage the CommonsCh ...
随机推荐
- mysql之主从复制
原理--> 在数据库层面,复制语句或者行,因为在数据库层面,故只有主服务器生成,并放到二进制日志里面,才能复制给从服务器. 原理--> mysql的主从复制基于异步,主要有三个进程执行,分 ...
- django中使用json.dumps处理数据时,在前台遇到字符转义的问题
django后台代码: import json ctx['dormitory_list'] = json.dumps([{", "is_checked": 1}, {&q ...
- Qt之HTTPS登录(集成QNetworkAccessManager提前修改QSslConfiguration,然后post)
简述 HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的安全版.即HTTP ...
- C# 文件/文件夹压缩
一.ZipFile ZipFile类用于选择文件或文件夹进行压缩生成压缩包. 常用属性: 属性 说明 Count 文件数目(注意是在ComitUpdat之后才有) Password 压缩包密码 Siz ...
- Linux读取文件路径问题
问题是这样的: 首先终端上有当前路径显示,我有个可执行程序代码是这样的: FILE fp = fopen(filename, "rb"); if(fp == NULL) ...
- javaWeb Cache技术――OSCache(转-全)
什么是osCache? 它是:http://baike.baidu.com/view/1835163.htm?fr=aladdin OSCache使用指南 一.下载安装 OSCache是一个基于web ...
- bzoj1641 [Usaco2007 Nov]Cow Hurdles 奶牛跨栏
Description Farmer John 想让她的奶牛准备郡级跳跃比赛,贝茜和她的伙伴们正在练习跨栏.她们很累,所以她们想消耗最少的能量来跨栏. 显然,对于一头奶牛跳过几个矮栏是很容易的,但是高 ...
- GNU C - 关于8086的内存访问机制以及内存对齐(memory alignment)
一.为什么需要内存对齐? 无论做什么事情,我都习惯性的问自己:为什么我要去做这件事情? 是啊,这可能也是个大家都会去想的问题, 因为我们都不能稀里糊涂的或者.那为什么需要内存对齐呢?这要从cpu的内存 ...
- python局域网alive ip侦听
python局域网alive ip侦听 作者:vpoet mails:vpoet_sir@163.com 注:写着玩,欢迎copy # -*- coding: cp936 -*- # coding = ...
- REDHAT、CenterOS使用安装Linux系统时的光盘镜像来安装软件
使用安装Linux系统时的光盘镜像来安装软件 (1)以虚拟机上,安装mysql为例: 查看mysql是否安装 rpm -qa|grep -i mysql 显示下面,证明mysql已安装客户端,下 ...