1. chunk-manifest-webpack-plugin
Allows exporting a manifest that maps chunk ids to their output files, instead of keeping the mapping inside the webpack bootstrap.
chunk-manifest-webpack-plugin
Package: chunk-manifest-webpack-plugin
Created by: soundcloud
Last modified: Mon, 13 Jun 2022 06:01:33 GMT
Version: 1.1.2
License: MIT
Downloads: 15,999
Repository: https://github.com/soundcloud/chunk-manifest-webpack-plugin

Install

npm install chunk-manifest-webpack-plugin
yarn add chunk-manifest-webpack-plugin

chunk-manifest-webpack-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.

Usage

Install via npm:

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

Install via yarn:

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

And then require and provide to webpack:

 // in webpack.config.js or similar
const ChunkManifestPlugin = require('chunk-manifest-webpack-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>

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin