Giter VIP home page Giter VIP logo

webpack-manifest-plugin's Introduction

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)
  ]
}

publicPath

Type: String

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

options.fileName

Type: String
Default: manifest.json

The manifest filename in your output directory.

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

Filter out files. more details

options.map

Type: function

Modify files details before the manifest is created. more details

options.sort

Type: function

Sort files before they are passed to generate. more details

options.generate

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

All entries in files correspond to the object structure described in the Hooks Options section.

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

options.serialize

Type: function
Default: (manifest) => JSON.stringify(manifest, null, 2)

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

Hooks Options

filter, map, sort 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.

License

MIT © Dane Thurber

webpack-manifest-plugin's People

Contributors

a-x- avatar andriijas avatar craigmichaelmartin avatar d34thwings avatar danethurber avatar davidmpaz avatar ficik avatar frequin avatar gmac avatar iliakan avatar jordaaash avatar joscha avatar martynovs avatar mastilver avatar modosc avatar mtbennett-godaddy avatar nathanbirrell avatar nickescallon avatar pouwerkerk avatar seethruhead avatar tikotzky avatar wtgtybhertgeghgtwtg avatar xx7y7xx avatar

Watchers

 avatar

Forkers

v0lume

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.