It involves statically analysing the code in order to find which parts of a given module or library are not being used, and cut them off the final bundle.
You often end up needing only 20–40% of the code you are shipping to the final user.
A couple of examples that might resonate with you:
If that sounds anything like you, check tree shaking out.
If you are using ES2015 import statement, here is what a static analyzer can do:
Needless to say, this can reduce the size of you bundle by just so much!
If you are looking for a way to experiment with this idea, do check rollup.js out!
I read each and every comment, and look forward to see what you think! Also, this piece is part of the #ASKTHEINDUSTRY project, which is a distributed interview to the web industry: you ask, I’ll answer, or find someone who can! Drop a comment if there is anything I can help you with!