I'm reading the Material UI documentation, and it states:
Notice that in the above example, we used:
import RaisedButton from 'material-ui/RaisedButton';
instead ofimport {RaisedButton} from 'material-ui';
This will make your build process faster and your build output smaller.
I cannot find any justification for why the use of default exports makes the build process faster or build output smaller.
My manager is asking us to refrain from using default exports, however a smaller build size is an important target for this project. I mentioned this quote by Material UI, and they said to find proof. I'd like some proof, please, as my attempts to compile it with Babel have shown default
to be larger if anything.
The key thing is not whether the module has a default export or not, but the fact that you import a module that includes all the Material UI Components (the material-ui
module) instead of the module that includes only the RaisedButton
component (the material-ui/RaisedButton
module).
To be absolutely clear: We should be using the module that only includes a single component, i.e. material-ui/RaisedButton
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With