reliable-module-ids-plugin

1.0.1 • Public • Published

Reliable Module IDs Plugin

GitHub license Build Status npm version Greenkeeper badge

This Webpack plugin provides more reliable module IDs for improved long-term caching and code reuse between project installations and builds. It is intended to bridge the gap between Webpack 4 and the deterministic IDs feature coming in Webpack 5.

Installation

This is a Node.js module available through the npm registry. Node 8 and Webpack 4.38 or higher are required.

Installation is done using the npm install command:

$ npm install --save-dev reliable-module-ids-plugin

Once installed the plugin can be added to your Webpack plugins configuration:

const ReliableModuleIdsPlugin = require('reliable-module-ids-plugin')
 
module.exports = {
  //...
  plugins: [
    new ReliableModuleIdsPlugin({
      // options
    })
  ]
}

If you have already configured optimization.moduleIds you should set this to false so Webpack will defer to the provided algorithm.

Options

hashFunction

The hashing algorithm to use, defaults to 'md5'. All functions from Node.JS' crypto.createHash are supported.

hashDigest

The encoding to use when generating the hash, defaults to 'hex'. All encodings from Node.JS' hash.digest are supported.

hashDigestLength

The prefix length of the hash digest to use, defaults to 8. Note that some generated IDs might be longer than specified here, to avoid module ID collisions.

Prior Art

This plugin is based upon Webpack's built-in HashedModuleIdsPlugin by Tobias Koppers and uses the node_modules path normalization as demonstrated in the SimpleNamedModulesPlugin by Tomer Brisker.

Development

This project uses Prettier for automatic code formatting and is tested with Jasmine.

License

This package is MIT licensed.

Readme

Keywords

Package Sidebar

Install

npm i reliable-module-ids-plugin

Weekly Downloads

111

Version

1.0.1

License

MIT

Unpacked Size

7.46 kB

Total Files

4

Last publish

Collaborators

  • i-like-robots