Closed supermoos closed 7 years ago
there isn't much benefit to that here, you always going to need 95% percent of the library to use it, so you don't gain much from treekshaking.
if you want to import individual components then you can do so like import FormField from 'react-formal/lib/Field'
Hmm, I might be wrong, but in my opinion I might easily not the 'inputs' part of this project (Select, date etc.) as seen in this screenshot, that's still 8.9kb. I know, I know, that's not a ton, but still, since it's authored in es6 it seems this should be possible.
And thanks for the library BTW :-)
Mind you those kb are uncompressed, so I guess I see your point :-)
ya it's not a ton, and its not actually likely that tree-shaking would help you at all there. It's not as smart as you might think, and often has to completely bail out of the optimization. You can completely avoid unused stuff tho by directly importing the components you want, like my example above!
Yeah, I tried that way of importing, but it doesn't seem to work when using the Form component like:
import Form from 'react-formal/lib/Form';
Is it possible to support es6 imports so I could import only FormField from react-formal, like:
import {Field} from 'react-formal';
Mainly looking for better tree-shaking support when used with webpack ^v.2