webpack-bundle-analyzer shows elliptic and bn.js included in my vendor.js But these modules are not used in code or included in package.json.
npm ls bn.js gives:
├─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
Application of Webpack:It helps to use different javascript files without having tension that will load first. It makes code shorter. It helps in converting many files other than javascript into modules. It compiles different javascript module.
Do you really need Webpack for a server side JavaScript project? As is usually the case in software engineering, the answer is “it depends.” If you're building a basic Express app that runs on Node. js, you don't need Webpack at all.
Your browser doesn't know how to import App from the ./App directory. The browser can only load static JS files. Hence, webpack configuration is needed for converting your React app into readable code that browsers can understand.
Should I Use Webpack? If you're building a complex Front End™ application with many non-code static assets such as CSS, images, fonts, etc, then yes, Webpack will give you great benefits.
Webpack includes elliptic
and bn.js
(and other, smaller modules) in your bundle if you import crypto
as a dependency somewhere in your code.
To avoid these huge dependencies, you can look for a specific npm module which provides just the function(ality) you need.
For example, I was importing crypto
to do;
const crypto = require('crypto');
const hmac = crypto.createHmac('sha1', buf);
... instead (in this situation...), you can install the create-hmac
module, and do;
const createHmac = require('create-hmac');
const hmac = createHmac('sha1', buf);
In case you need some motivation; removing crypto
as a dependancy trimmed 150Kb off our gzipped bundle size (but YMMV depending on which crypto methods you're using).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With