Webpack : Dedupe of node modules libraries not working

Viewed 145

I need help in avoiding duplicates in my vendor chunk. Bundle Analyzer shows that bn.js is repeated. I suspect there are others too.

npm ls bn.js tells

└─┬ webpack@4.46.0
 └─┬ node-libs-browser@2.2.1
  └─┬ crypto-browserify@3.12.0
   ├─┬ browserify-sign@4.2.1
   │ ├── bn.js@5.2.0 
   │ ├─┬ browserify-rsa@4.1.0
   │ │ └── bn.js@5.2.0  deduped
   │ ├─┬ elliptic@6.5.4
   │ │ └── bn.js@4.12.0 
   │ └─┬ parse-asn1@5.1.6
   │   └─┬ asn1.js@5.4.1
   │     └── bn.js@4.12.0 
   ├─┬ create-ecdh@4.0.4
   │ └── bn.js@4.12.0 
   ├─┬ diffie-hellman@5.0.3
   │ ├── bn.js@4.12.0 
   │ └─┬ miller-rabin@4.0.1
   │   └── bn.js@4.12.0 
   └─┬ public-encrypt@4.0.3
     └── bn.js@4.12.0 

Please advice how can I avoid this if the library node-libs-browser@2.2.1 itself wants duplicates.

I am building a react application for the browser. Client side rendering.

Bundle Analyzer shows that bn.js is repeated

0 Answers
Related