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

Why '.../dist/' ? #100

Closed
ebeloded opened this issue Jun 11, 2018 · 2 comments
Closed

Why '.../dist/' ? #100

ebeloded opened this issue Jun 11, 2018 · 2 comments

Comments

@ebeloded
Copy link

Dear maintainers,

I find it a bit off-putting that to use a component one has to import the compiled version from @material/react-button/dist (as opposed to simply @material/react-button). Is there a reason why you decided to make it so?

Apart from the packages in this repo I have never had to reference /dist - it is not obvious for me as a component consumer. What's more, in the docs to every component, the imports in demo look as one would expect :import Button from '@material/react-button'. Yet this won't work without having to transpile imported modules or in create-react-app context.

Please, let me if there is a good reason behind this decision I may not understand.

@ghost
Copy link

ghost commented Jun 12, 2018

Have you considered the impact using the compiled version will have on your bundle size? Using the uncompiled version allows for tree shaking which will lead to smaller bundle sizes.

@moog16
Copy link

moog16 commented Jun 20, 2018

@ebeloded sorry for the late reply. We thought that the uncompiled components would be used more than the compiled components. Like @ben-mckernan referenced, we saw it as a bundle savings. We also thought that having the transpiled code in a /dist or /build directory as being more semantic. However it seems that our main target audience are developers using CRA, which was short-sighted on our part.

After installing a few other packages and seeing what is distributed from the entry point it seems like we have this backwards, and in fact import Button from '@material/react-button should have the compiled code. And as reference in #107 we are causing more issues.

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