-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ES6] Use import over require #2333
Conversation
[ES6] Use import over require
@oliviertassinari What do you think about all the indexes? |
Could you be more specific? I don't follow. |
Can't we use es6 export style for this without having to require things? |
Oh, looks like I have forgotten this file. |
Not just this one, all the indexes of each folder follow this pattern |
@apercu You are right, thanks for noticing the we need to update the index. I'm wondering if adopting the ES6 module definition for the index would make webpack only import the desired file with the following structure. cc @subjectix import {DatePicker} from 'material-ui';` |
@oliviertassinari I don't know if webpack can prune the tree or under what conditions it can. But it would be great if it was possible. it will need research. |
Yeah I was wondering about that since my material-ui is taking 40% of my project bundle loading all the svg icons while I'm only using a couple. Will do a bit of tests and can submit a PR |
I have opened an issue to continue the conversation #2558.
We advise people to directly require the needed component, but that would be better if we can use the index.js (for code clarify and modifying the file name without introducing breaking changes) |
Following #2253, this PR update the
src
folder.