Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@abcfe/webpack-manifest

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abcfe/webpack-manifest

webpack plugin for generating asset manifests

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Webpack Manifest Plugin

Webpack plugin for generating an asset manifest.

Install

npm install --save-dev abc-webpack-manifest

Usage

In your webpack.config.js

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

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"
}

Configuration

A manifest is configurable using constructor options:

new ManifestPlugin({
  fileName: 'my-manifest.json',
  basePath: '/app/'
  seed: {
    name: 'My Manifest'
  }
})

Options:

fileName

Type: String
Default: manifest.json

The manifest filename in your output directory.

basePath

Type: String

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

publicPath

Type: String

A path prefix used only on output files, similar to Webpack's output.publicPath. Ignored if basePath was also provided.

stripSrc

Type: String, RegExp

Removes unwanted strings from source filenames.

writeToFileEmit

Type: Boolean
Default: false

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

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.

filter

Type: function

Filter out files. more details

map

Type: function

Modify files details before the manifest is created. more details

reduce

Type: function
Default: (manifest, {name, path}) => ({...manifest, [name]: path})

Create the manifest. It can return anything as long as it's serialisable by JSON.stringify. Use the seed options to populate manifest. more details

extensions

Default: ['.js', '.css']

增加了后缀名的过滤

Hooks Options

filter, map, reduce takes as an input an Object with the following properties:

path

Type: String

chunk

Type: Chunk

name

Type: String, null

isChunk

Type: Boolean

isInitial

Type: Boolean

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

isAsset

Type: Boolean

isModuleAsset

Type: Boolean

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

FAQs

Package last updated on 01 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts