简体   繁体   English

清单块Webpack中的清单含义

[英]Manifest meaning in chunkhash webpack

I'm learning webpack and how to use the chunkhash features. 我正在学习webpack以及如何使用chunkhash功能。 In this example on github, it uses a 'manifest' name in the plugin. 在github上的此示例中,它在插件中使用“清单”名称。

What is it for? 这是为了什么 I didn't find any explanation for its use case. 我没有找到有关其用例的任何解释。

Thank you. 谢谢。

var path = require("path");
var webpack = require("../../");
module.exports = {
    entry: {
        main: "./example",
        common: ["./vendor"] // optional
    },
    output: {
        path: path.join(__dirname, "js"),
        filename: "[name].[chunkhash].js",
        chunkFilename: "[chunkhash].js"
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin({
            names: ["common", "manifest"]
        })
        /* without the "common" chunk:
        new webpack.optimize.CommonsChunkPlugin({
            name: "manifest"
        })
        */
    ]
};

Little late to the party, but I've just stumbled upon your question. 晚会来晚了,但是我偶然发现了你的问题。 This configuration will extract webpack's runtime and manifest data into a separate chunk. 此配置将提取webpack的运行时并将清单数据清单到单独的块中。

The behaviour is described here https://webpack.js.org/plugins/commons-chunk-plugin/#manifest-file : 行为在这里描述https://webpack.js.org/plugins/commons-chunk-plugin/#manifest-file

To extract the webpack bootstrap logic into a separate file, use the CommonsChunkPlugin on a name which is not defined as entry . 要将webpack引导程序逻辑提取到一个单独的文件中, CommonsChunkPlugin对未定义为entryname使用CommonsChunkPlugin Commonly the name manifest is used. 通常使用名称manifest

You can read more about the manifest at https://webpack.js.org/concepts/manifest/ while the reasons for extracting it to a separate file are nicely explained here: https://medium.com/webpack/predictable-long-term-caching-with-webpack-d3eee1d3fa31 and here: https://webpack.js.org/guides/caching/ (it's required for a predictable naming of vendor chunks to improve their caching). 您可以在https://webpack.js.org/concepts/manifest/上了解有关清单的更多信息,而在此处很好地解释了将清单提取到单独文件的原因: https : //medium.com/webpack/predictable-long -term-caching-with-webpack-d3eee1d3fa31以及此处: https//webpack.js.org/guides/caching/ (可预测地命名供应商块以改善其缓存是必需的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM