Coder Social home page Coder Social logo

vinnymac / chunk-manifest-webpack-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from soundcloud/chunk-manifest-webpack-plugin

0.0 3.0 0.0 17 KB

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

License: MIT License

JavaScript 100.00%

chunk-manifest-webpack-plugin's Introduction

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>

Note

  • Webpack configurations that set watch: true won't generate a file and will cause this plugin to silently fail. This includes both webpack-dev-server and webpack-dev-middleware.

chunk-manifest-webpack-plugin's People

Contributors

amilajack avatar brandondoran avatar diurnalist avatar epilande avatar gingur avatar jackub avatar kronuz avatar matthiasfeist avatar shakyshane avatar spadgos avatar tuckercowie avatar vinnymac avatar welljs avatar

Watchers

 avatar  avatar  avatar

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.