Does responsive native optimize JavaScript code?

I read the compiler guide. They have many optimization methods, such as removing redundant code or removing unused variables and none of the methods used.
But scripting languages ​​like javascript do not have a compiler, so accept it without optimization.
I read an article about the JS optimizer, like:

- Google Closure Compiler https://github.com/google/closure-compiler - UglifyJS https://github.com/mishoo/UglifyJS 

And the real question is, do platforms like reactive, angular, code optimizer use, or should I use it myself?

+3
source share
1 answer

The React Native script bundler, Metro , first converts your code using Babel . In production build mode, it then runs your code through UglifyJS .

The default configuration does not make any advanced optimizations, such as tremors or deduplication of trees.

If you want to apply more advanced optimizations, you can try to find out if they can be achieved at the stage of transpilation using the Babel plugins. If not, it might be easier to use Haul , an alternative webpack based React Native bundler.

However, as always, before optimizing prematurely, think about what indicators you are trying to improve and measure whether your optimizations really achieve your goals.

+5
source

Source: https://habr.com/ru/post/1275768/


All Articles