UNPKG

2.01 kBMarkdownView Raw
1# webpack-analyze-duplication-plugin [![Latest version](https://badgen.net/npm/v/webpack-analyze-duplication-plugin)](https://npm.im/webpack-analyze-duplication-plugin) [![Monthly downloads](https://badgen.net/npm/dm/webpack-analyze-duplication-plugin)](https://npm.im/webpack-analyze-duplication-plugin) [![Install size](https://packagephobia.now.sh/badge?p=webpack-analyze-duplication-plugin)](https://packagephobia.now.sh/result?p=webpack-analyze-duplication-plugin)
2
3Detect duplicated modules in your Webpack build.
4
5Produce a `duplication-report.json` that contains a full-report on duplicated modules.
6
7Example snippet:
8```json5
9[
10 {
11 // The duplicated module path
12 "module": "/node_modules/vue/dist/vue.esm.js",
13
14 // Size of module
15 "size": "326.4 kB",
16
17 // Size savings if de-duped
18 "potential-size-savings": "979.2 kB",
19
20 // Chunks the module is duplicated in
21 "included-in": [
22 ["index.js"],
23 ["some-file.js"],
24 ...
25 ],
26 },
27
28 ...
29]
30```
31
32<sub>If you like this project, please star it & [follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️</sub>
33
34## 🙋‍♂️ Why?
35Webpack configuration is complicated. It's easy to overlook misconfigurations and bloated distribution bundles.
36
37Use this plugin to make sure there are no duplicated modules, or that they're only duplicated where you want them to be.
38
39## 🚀 Install
40```sh
41npm i -D webpack-analyze-duplication-plugin
42```
43
44## 🚦 Quick Setup
45Add to your `webpack.config.js`:
46
47```diff
48+ const AnalyzeDuplicationPlugin = require('webpack-analyze-duplication-plugin')
49
50 module.exports = {
51 ...
52
53 plugins: [
54+ new AnalyzeDuplicationPlugin()
55 ]
56 }
57```
58
59## 👨‍👩‍👦‍👦 Related
60
61- [webpack-distsize](https://github.com/privatenumber/webpack-distsize) - Track Webpack output size via version control
62- [webpack-dependency-size](https://github.com/privatenumber/webpack-dependency-size) - Webpack plugin to get an overview of bundled dependencies and their size