0.2.2 • Published 8 years ago

toxic-webpack-manifest-plugin v0.2.2

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

toxic-webpack-manifest-plugin

Build Status Coverage Status npm dependency Status devDependency Status

This webpack plugin will generate a JSON files for the hashed file version. It include entry chunk and async chunk. You can split them by entry or if you use html-webpack-plugin, you can sort them according to page.

Installation

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

Usage

const ToxicWebpackManifestPlugin = require('toxic-webpack-manifest-plugin');
...
{
  plugins: [
    new ToxicWebpackManifestPlugin(),
  ]
}

Options

OptionTypeDefaultDescription
outputPathstringundefinedthe output path of manifest. we will use the webpack output.path as default
namestringtoxic-manifest.jsonmanifest name
writeToDiskbooleanfalseWrite the manifest to disk using fs , it's useful if you are using webpack-dev-server and need to update the file.
htmlAsEntrybooleanfalseIf you use html-webpack-plugin, we can split the file accroding to page.
prettybooleantrueneed to prettify the output json
spacenumber2The number use by JSON.stringify when using pretty.
includeboolean|Function|string|RegExptrueTo check should we include the file. true means include all, false means exclude all. The string will be transfer into RegExp, which means only include when it match the RegExp. The function should return boolean.
excludeboolean|Function|string|RegExpfalsethe opposite of include
publicPathstringundefinedthe publicPath for file, use the webpack output.publicPath as default one.
distinctAsyncbooleantrueshould we clarify which one is async
filenameFormatterFunctionundefinedYou can change the filename if you provide this. You can get the filename and publicPath

example

The manifest example is here.

default set

{
  "bundle": {
    "entry": [
      "/bundle.js"
    ],
    "async": [
      "/chunk.2ee0460aecebfc572a43.js",
      "/chunk.bee94a217f36937c96aa.js"
    ]
  },
  "vendor": {
    "entry": [
      "/vendor.js"
    ],
    "async": []
  },
  "another": {
    "entry": [
      "/another.js"
    ],
    "async": []
  }
}

html as entry

{
  "index.html": {
    "entry": [
      "/bundle.js",
      "/vendor.js"
    ],
    "async": [
      "/chunk.2ee0460aecebfc572a43.js",
      "/chunk.bee94a217f36937c96aa.js"
    ]
  },
  "another.html": {
    "entry": [
      "/another.js"
    ],
    "async": []
  }
}

do not distinct async

{
  "bundle": [
    "/bundle.js",
    "/chunk.2ee0460aecebfc572a43.js",
    "/chunk.bee94a217f36937c96aa.js"
  ],
  "vendor": [
    "/vendor.js"
  ],
  "another": [
    "/another.js"
  ]
}