Reputation: 128
I have a Reactjs application created using Create React app which while starting and building gives a lot of warnings which states that I have unused vars or imports in my Components.
./src/components/home/Header.js
Line 10: 'Switch' is defined but never used no-unused-vars
Line 10: 'Route' is defined but never used no-unused-vars
Does having no-unused-vars
have a considerable impact on final bundle size and build time of the application. Can I reduce build time and bundle size by removing all these warnings?
Upvotes: 7
Views: 7817
Reputation: 1450
Checkout this package https://www.npmjs.com/package/source-map-explorer. And run
source-map-explorer bundle.js
It will give you detailed screenshot of your bundle file like which package is taking too much file size and all. Change the way you are importing packages mentioned in How to minimize the size of webpack's bundle? and also if some particular package is causing a size issue then switch to alternative packages.
Upvotes: 6