Skip to content

Allows exporting a manifest that maps chunk ids to their output files, instead of keeping the mapping inside the webpack bootstrap.

License

Notifications You must be signed in to change notification settings

jakeNiemiec/webpack-chunk-manifest-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webpack-chunk-manifest-plugin

Allows exporting a JSON file that maps chunk ids to their resulting asset files. Webpack can then read this mapping, assuming it is provided somehow on the client, instead of storing a mapping (with chunk asset hashes) in the bootstrap script, which allows to actually leverage long-term caching.

NPM

This repo was (lovingly) forked from soundcloud/chunk-manifest-webpack-plugin.

Usage

Install via npm:

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

Install via yarn:

yarn add --dev webpack-chunk-manifest-plugin

And then require and provide to webpack:

// in webpack.config.js or similar
const ChunkManifestPlugin = require('webpack-chunk-manifest-plugin');

module.exports = {
  // your config values here
  plugins: [
    new ChunkManifestPlugin({
      filename: 'manifest.json',
      manifestVariable: 'webpackManifest',
      inlineManifest: false
    })
  ]
};

Options

filename

Where the manifest will be exported to on bundle compilation. This will be relative to the main webpack output directory. Default = "manifest.json"

manifestVariable

What JS variable on the client webpack should refer to when requiring chunks. Default = "webpackManifest"

inlineManifest

Whether or not to write the manifest output into the html-webpack-plugin. Default = false

// index.ejs
<body>
    <!-- app -->
    <%= htmlWebpackPlugin.files.webpackManifest %>
</body>

About

Allows exporting a manifest that maps chunk ids to their output files, instead of keeping the mapping inside the webpack bootstrap.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published