Webpack Chunks to JSON Plugin

1.0.4 · maintenance · verified Tue Apr 21

chunks-2-json-webpack-plugin is a utility plugin specifically designed for Webpack 4, which outputs a JSON manifest of your project's build artifacts. Its core purpose is to provide an external system with a predictable map of generated chunk filenames, particularly when these names include content hashes for caching. This addresses common scenarios where a deployment environment needs to dynamically reference or inject build assets without direct knowledge of Webpack's output naming conventions. The current stable version is 1.0.4, though the project appears to be in maintenance mode given its specific tie to Webpack 4. It differentiates itself by offering a simple, dependency-free solution for Webpack 4, producing a configurable JSON structure that details file types (e.g., `js`, `css`, `js.map`) grouped by chunk names, facilitating easier integration with external rendering systems.

Warnings

Install

Imports

Quickstart

This example demonstrates how to configure the plugin in a Webpack 4 `webpack.config.js` file to output a `build-manifest.json` file, specifying an output directory and public path.

const Chunks2JsonPlugin = require('chunks-2-json-webpack-plugin');
const path = require('path');

const publicPath = '/app/';

module.exports = {
  entry: './src/index.js',
  output: {
    filename: '[name].[hash].js',
    path: path.resolve(__dirname, 'dist'),
    publicPath
  },
  plugins: [
    new Chunks2JsonPlugin({ outputDir: 'dist/', publicPath })
  ]
};

view raw JSON →