webpack-chunkmap-plugin

0.1.2 • Public • Published

webpack-chunkmap-plugin

本插件在编译完成之后,会生成一个mapping文件,来映射静态服务器的文件。配合沪江的前后端分离工作。用法想见webpack的官方文档中插件的使用说明,如:

chunkmapPlugin = require("webpack-chunkmap-plugin"),
...
plugins: [
            new chunkmapPlugin({
                serverPath: "//res.hjfile.cn/lib/editor/",
                prefix: "/st/",
                mappingFile: "mapping.json"
            })
        ]

通过此插件将生成如下内容的文件

{
    "/st/editor.js":"//res.hjfile.cn/lib/editor/editor-ae82c067ab8e3b1528d4.js",
    "/st/editor.css":"//res.hjfile.cn/lib/editor/editor.css",
    "/st/test.js":"//res.hjfile.cn/lib/editor/test-ae82c067ab8e3b1528d4.js"
}

安装

hnpm install webpack-chunkmap-plugin

options

  • serverPath

    在生成的映射文件中,指定静态服务器的地址片段,将这个值和生成的文件名组合成静态服务器上的访问地址

  • prefix

    生成映射文件key的前缀,默认为空。 如上述demo中,此项值为:"/st/"

  • mappingFile

    输出的映射文件地址,基础路径为资源输出目录。

  • ignore

    过滤掉不需要生成在映射文件中的文件,该值为正则表达式。

Readme

Keywords

Package Sidebar

Install

npm i webpack-chunkmap-plugin

Weekly Downloads

0

Version

0.1.2

License

MIT

Last publish

Collaborators

  • dail3513