Manifest File
【Manifest File】
on every build, webpack generates some webpack runtime code, which helps webpack do its job. When there is a single bundle, the runtime code resides in it. But when multiple bundles are generated, the runtime code is extracted into the common module, here the vendor
file.
To prevent this, we need to extract out the runtime into a separate manifest file. Even though we are creating another bundle, the overhead is offset by the long term caching benefits that we obtain on the vendor
file.
var webpack = require('webpack');
var path = require('path'); module.exports = function() {
return {
entry: {
main: './index.js' //Notice that we do not have an explicit vendor entry here
},
output: {
filename: '[name].[chunkhash].js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: function (module) {
// this assumes your vendor imports exist in the node_modules directory
return module.context && module.context.indexOf('node_modules') !== -1;
}
}),
//CommonChunksPlugin will now extract all the common modules from vendor and main bundles
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest' //But since there are no more common modules between them we end up with just the runtime code included in the manifest file
})
]
};
}
第一次执行vendor时,只有一个bundle,就是main。CommonsChunkPlugin会将node_modules从main中分享出来,从而成为vendor。
第二次执行manifest时,有两个bundle,main、vender。CommonsCHunkPlugin发现两个bunlde没有公共module,所以manifest内不含任何Module。
runtime code会放放置后最后成的bundle中。
参考:https://webpack.js.org/guides/code-splitting-libraries/#manifest-file
Manifest File的更多相关文章
- Android -- The Manifest File
Before the Android system can start an app component, the system must know that the component exists ...
- How to build .apk file from command line(转)
How to build .apk file from command line Created on Wednesday, 29 June 2011 14:32 If you don’t want ...
- HTML5离线缓存Manifest
web app不比PC,有性能和流量方面的考虑,离线应用越来越重要,虽然浏览器有缓存机制,但是时常不靠谱,更何况普通情况下html文件是没法缓存的,断网之后一切over. 什么是manifest? 简 ...
- AndroidManifest File Features
http://www.android-doc.com/guide/topics/manifest/manifest-intro.html The following sections describe ...
- Intent官方教程(5)在manifest中给组件添加<Intent-filter>
Receiving an Implicit Intent To advertise which implicit intents your app can receive, declare one o ...
- How to Run a .Jar Java File
.jar files are used for archiving, archive unpacking. One of the essential features of jar file is l ...
- LevelDB源码之五Current文件\Manifest文件\版本信息
版本信息有什么用?先来简要说明三个类的具体用途: Version:代表了某一时刻的数据库版本信息,版本信息的主要内容是当前各个Level的SSTable数据文件列表. VersionSet:维护了一份 ...
- 一分钟明白 VS manifest 原理
什么是vs 程序的manifest文件 manifest 是VS程序用来标明所依赖的side-by-side组建,如ATL, CRT等的清单. 为什么要有manifest文件 一台pc上,用一组建往往 ...
- 一分钟明确 VS manifest 原理
什么是vs 程序的manifest文件 manifest 是VS程序用来标明所依赖的side-by-side组建,如ATL, CRT等的清单. 为什么要有manifest文件 一台pc上,用一组建往往 ...
随机推荐
- Java Swing类 颜色、按键状态判断例子代码
package rom; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; ...
- Ruby学习笔记7: 添加身份验证(adding Authentication)
我们已经完成了Category & Product页面内容的增删改查,再加入一个身份验证即可成为一个较完整的Rails App了.本文就来完成这个任务. We now need to give ...
- Xcode6在iPhone5+iOS7模拟器上编译,上下有黑边问题
http://94it.net/a/jingxuanboke/2015/0113/447679.html
- Flex的一些小实例
1,以上是一个导航菜单 2一下是一个撑开的mx:Spacer
- PyCharm 安装使用
服务器激活地址(转载)http://www.cnblogs.com/littlehb/p/7784517.html PyCharm 服务器激活地址: 最近用edu邮箱申请了一个JetBrains针 ...
- git 简单的操作命令
1, 克隆已存在项目 => git clone url 2, 拉取代码 => git pull 3, 配置账号密码 git config --global user.email &quo ...
- office2016系列产品关闭时卡顿
关闭Print Spooler服务其方法如下: win+r键–>输入services.msc点击确定如下图 单击word中的文件-选项-加载项-COM加载项-转到,将所有加载项前面的勾都去掉(不 ...
- day16-小数据池
一,什么是代码块 Python程序是由代码块构造的.块是一个python程序的文本,他是作为一个单元执行的. 代码块:一个模块,一个函数,一个类,一个文件等都是一个代码块. 而作为交互方式输入的每个命 ...
- UI5-学习篇-3-Local SAP WEB IDE下载
1.下载地址 https://tools.hana.ondemand.com/#sapui5 有两个版本,针对各自系统环境选择对应的个人版本下载后解压. 个人版:个人试用 生产版:在云平台SCP付费订 ...
- 09_组件三大属性(3)_refs和事件处理
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...