/dedupe-string-plugin

Deduplicate strings from javascript files

Primary LanguageJavaScriptMIT LicenseMIT

dedupe-string-plugin

Build Status Known Vulnerabilities Greenkeeper badge

Dedupe-String-Plugin is a plugin for webpack that is optimized to work with gzip and remove duplicate strings that the gzip compression algorithm is not going to be able to dedupe.

Before dedupe-string-plugin:
function thing() {
  React.createElement('div');
  // ... somewhere outside of the gzip sliding window (32KB)
  React.createElement('div');
}
After dedupe-string-plugin:
function thing() {
  const e = 'div';
  React.createElement(e);
  // ... somewhere outside of the gzip sliding window (32KB
  React.createElement(e);
}
Webpack usage
var DedupeString = require('dedupe-string-plugin');

module.exports = {
  plugins: [
    new DedupeString()
  ]
};