Skip to content
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

Question: direct importing vs deconstruction #609

Closed
besh opened this issue Oct 3, 2016 · 2 comments
Closed

Question: direct importing vs deconstruction #609

besh opened this issue Oct 3, 2016 · 2 comments

Comments

@besh
Copy link

besh commented Oct 3, 2016

Hey there. This isn't a feature request or a bug. Just a general question.

So, we have been doing import { Button, Form, Dropdown } from 'stardust'; but that pulls in the entire stardust lib. The reality is, we're only using 10% of the stardust components so I started thinking about direct re-exporting in a lib file like so

export { default as Button } from 'stardust/dist/commonjs/elements/Button/Button';

Then when required, we can simply import { Button, SomeOtherComponent } from 'lib/stardust' and know that we're only bundling code that we're actually using.

So now I'm wondering, outside of the obvious breaking changes that may occur as stardust has updates, do you see any potential downsides to this approach?

@jeffcarbs
Copy link
Member

Small custom builds is definitely something we're targeting, although that likely won't happen until we've shipped v1.0.0.

We're thinking something similar to https://github.com/lodash/babel-plugin-lodash which would allow you to write:

import { Button, Form, Dropdown } from 'stardust'

and have it automatically converted to:

import Button from 'stardust/elements/Button/Button'
import Form from 'stardust/collections/Form/Form'
import Dropdown from 'stardust/modules/Dropdown/Dropdown'

as a build step.

See here for more discussion on this: https://github.com/TechnologyAdvice/stardust/issues/524
See here for more insight into timelines: https://github.com/TechnologyAdvice/stardust/issues/606#issuecomment-251182192

Hope this helps!

@besh
Copy link
Author

besh commented Oct 3, 2016

Great response. I'll hang out in the other issues for discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants