webpack-manifest-plugin

webpack plugin for generating asset manifests

  • 所有者: shellscape/webpack-manifest-plugin
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Webpack Manifest Plugin Build Status codecov Gitter

Webpack plugin for generating an asset manifest.

NOTE: The following is related to the next major version of webpack-manifest-plugin, please check https://github.com/danethurber/webpack-manifest-plugin/blob/1.x/README.md for v1 documentation

Install

npm install --save-dev webpack-manifest-plugin

Usage

In your webpack.config.js

var ManifestPlugin = require('webpack-manifest-plugin');

module.exports = {
    // ...
    plugins: [
      new ManifestPlugin()
    ]
};

This will generate a manifest.json file in your root output directory with a mapping of all source file names to their corresponding output file, for example:

{
  "mods/alpha.js": "mods/alpha.1234567890.js",
  "mods/omega.js": "mods/omega.0987654321.js"
}

API:

// webpack.config.js

module.exports = {
  output: {
    publicPath
  },
  plugins: [
    new ManifestPlugin(options)
  ]
}

options.fileName

Type: String
Default: manifest.json

By default the plugin will emit manifest.json to your output directory. Can override with an absolute path.

options.publicPath

Type: String
Default: output.publicPath

A path prefix that will be added to values of the manifest.

options.basePath

Type: String

A path prefix for all keys. Useful for including your output path in the manifest.

options.writeToFileEmit

Type: Boolean
Default: false

If set to true will emit to build folder and memory in combination with webpack-dev-server

options.seed

Type: Object
Default: {}

A cache of key/value pairs to used to seed the manifest. This may include a set of custom key/value pairs to include in your manifest, or may be used to combine manifests across compilations in multi-compiler mode. To combine manifests, pass a shared seed object to each compiler's ManifestPlugin instance.

options.filter

Type: Function(FileDescriptor): Boolean

Filter out files. FileDescriptor typings

options.map

Type: Function(FileDescriptor): FileDescriptor

Modify files details before the manifest is created. FileDescriptor typings

options.sort

Type: Function(FileDescriptor): number

Sort files before they are passed to generate. FileDescriptor typings

options.generate

Type: Function(Object, FileDescriptor, string[]): Object
Default: (seed, files, entrypoints) => files.reduce((manifest, {name, path}) => ({...manifest, [name]: path}), seed)

Create the manifest. It can return anything as long as it's serialisable by JSON.stringify. FileDescriptor typings

options.serialize

Type: Function(Object): string
Default: (manifest) => JSON.stringify(manifest, null, 2)

Output manifest file in different format then json (i.e. yaml).

FileDescriptor

FileDescriptor {
  path: string;
  name: string, null;
  isInitial: boolean;
  isChunk: boolean;
  chunk?: Chunk;
  isAsset: boolean;
  isModuleAsset: boolean;
}

chunk

Type: Chunk

Only available if isChunk is true

isInitial

Type: Boolean

Is required to run you app. Cannot be true if isChunk is false.

isModuleAsset

Type: Boolean

Is required by a module. Cannot be true if isAsset is false.

License

MIT © Dane Thurber

主要指標

概覽
名稱與所有者shellscape/webpack-manifest-plugin
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台
許可證MIT License
所有者活动
創建於2015-03-21 22:36:51
推送於2025-03-11 23:18:05
最后一次提交2025-03-11 19:15:46
發布數40
最新版本名稱v5.0.1 (發布於 )
第一版名稱v0.0.2 (發布於 2015-05-21 14:59:58)
用户参与
星數1.4k
關注者數16
派生數183
提交數211
已啟用問題?
問題數165
打開的問題數1
拉請求數83
打開的拉請求數0
關閉的拉請求數55
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?