0

Is there any analyser/parser that will parse my code, take the code from libraries that i really use and need, reduce unnecessary library code and make finally a minified package?

For example if im using only $(smth).show() in jQuery then this reducer only take the code and dependencies responsible for show() and exactly this case of the selector and remove anything else

Thanks

0

A very popular tool for this is Webpack which in its newest release v4 has "tree-shaking" capabilities. It can remove unnecessary code. (and optionally minifies and reduces, creates sourcemaps and more). Another such bundler is RollupJS.

However

  • your code (and the code in the libraries you are using) has to be written in a very specific way in order for treeshaking to work.
  • webpack and rollup.js can take some time to learn and set-up
  • they are nodejs based so you need to learn node concepts first
  • exactly what i was looking for, thanks – user2890234 Oct 18 '18 at 14:28
  • i've also found google closure compiler with advanced mode which is the best for JS optimizing as far as i can see – user2890234 Oct 18 '18 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.