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的更多相关文章

  1. Android -- The Manifest File

    Before the Android system can start an app component, the system must know that the component exists ...

  2. 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 ...

  3. HTML5离线缓存Manifest

    web app不比PC,有性能和流量方面的考虑,离线应用越来越重要,虽然浏览器有缓存机制,但是时常不靠谱,更何况普通情况下html文件是没法缓存的,断网之后一切over. 什么是manifest? 简 ...

  4. AndroidManifest File Features

    http://www.android-doc.com/guide/topics/manifest/manifest-intro.html The following sections describe ...

  5. Intent官方教程(5)在manifest中给组件添加<Intent-filter>

    Receiving an Implicit Intent To advertise which implicit intents your app can receive, declare one o ...

  6. 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 ...

  7. LevelDB源码之五Current文件\Manifest文件\版本信息

    版本信息有什么用?先来简要说明三个类的具体用途: Version:代表了某一时刻的数据库版本信息,版本信息的主要内容是当前各个Level的SSTable数据文件列表. VersionSet:维护了一份 ...

  8. 一分钟明白 VS manifest 原理

    什么是vs 程序的manifest文件 manifest 是VS程序用来标明所依赖的side-by-side组建,如ATL, CRT等的清单. 为什么要有manifest文件 一台pc上,用一组建往往 ...

  9. 一分钟明确 VS manifest 原理

    什么是vs 程序的manifest文件 manifest 是VS程序用来标明所依赖的side-by-side组建,如ATL, CRT等的清单. 为什么要有manifest文件 一台pc上,用一组建往往 ...

随机推荐

  1. JDK源码阅读顺序

      很多java开发的小伙伴都会阅读jdk源码,然而确不知道应该从哪读起.以下为小编整理的通常所需阅读的源码范围. 标题为包名,后面序号为优先级1-4,优先级递减 1.java.lang 1) Obj ...

  2. java BASE64流 输出图片。

    亲测3个请求都可用,没有测试性能问题.仅供参考 BASE64Decoder Eclipsse 类可能引用不了解决方案链接:http://blog.csdn.net/JBxiaozi/article/d ...

  3. 重识linux-压缩文件的原理

    1 一种压缩原理 在系统中,系统使用byte作为最小单位来描述文件大小,但是计算机最小的单位是bit 一个byte=8bit,通常描述一个文件,计算机是使用0和1来存储的,所以系统工程师利用技术把为0 ...

  4. 关于spire wb.SaveToPdf(f_pdf) excell 转为pdf 乱码问题

    excell 可以合并单元格,但是在单元格内容不要用 alt+enter换行,否则就会出现乱码.

  5. Linux 删除指定时间的文件

    find /root/demo -mmin +10 -type f -name '*.png' -exec rm -rf {} \; find 相关:http://man.linuxde.net/fi ...

  6. html to docx

    public static void main(String[] args) throws Exception{ //创建 POIFSFileSystem 对象 POIFSFileSystem poi ...

  7. 在IDEA中修改项目的名称

  8. Linux主题:获取帮助

    Linux有多种方式获取帮助,这些帮助通过不同的命令,获得不同详细程度和文字量的帮助. help help方式有两种用法,一种是help command,另一种是command --help.前一种是 ...

  9. python模块os

    一.os模块概述 Python os模块包含普遍的操作系统功能.如果你希望你的程序能够与平台无关的话,这个模块是尤为重要的.(一语中的) 二.常用方法 1.os.name 输出字符串指示正在使用的平台 ...

  10. 半精度浮点数取5bit指数位

    半精度浮点是指用16bit表示一个浮点数,最高1bit为符号位,中间5bit为指数a,低10bit为尾数b Value = (符号位)(1+b/1024)*(2^(a-16)) 程序很简单,用pyin ...