Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does babel convert "true" to "!0"

I have inspected my converted code and i have seen that true is converted to !0

Example:

 let obj = {
    loading: true
 }

Is converted to:

 let obj = {
    loading: !0
 }

Why is that? Is it because of performance reason or because something else?

like image 875
Ifaruki Avatar asked Dec 21 '25 18:12

Ifaruki


1 Answers

For minifaction, ie: smaller bundle size. See also: babel-plugin-transform-minify-booleans

like image 168
Igor Avatar answered Dec 24 '25 08:12

Igor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!