1

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

1 Answer 1

1

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
2
  • exactly what i was looking for, thanks Commented Oct 18, 2018 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 Commented Oct 18, 2018 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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