Why is the default export / import of ES properties faster than name module properties?

I read the documentation on the material interface and it says:

Please note that in the above example we used: import RaisedButton from 'material-ui/RaisedButton';instead import {RaisedButton} from 'material-ui';This will make your build faster and your build result smaller.

I cannot find excuses why using the default export makes the build process faster or reduces output.

My manager asks us to refrain from using the default export, but a smaller build size is an important goal for this project. I mentioned this quote in Material UI and they said to find evidence. I would like to get some evidence, as my attempts to compile it with Babel showed that there defaultwould be more if anything.

+4
source share
1 answer

It doesn’t matter if the module has export by default or not, but the fact that you are importing a module that includes all components of the material user interface (module material-ui) instead of a module that includes only RaisedButton(module material-ui/RaisedButton).

: , , .. material-ui/RaisedButton.

+9

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


All Articles