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

UMD package: export MaterialUI variable #12387

Closed
tkrotoff opened this issue Aug 2, 2018 · 8 comments
Closed

UMD package: export MaterialUI variable #12387

tkrotoff opened this issue Aug 2, 2018 · 8 comments
Labels
breaking change new feature New feature or request
Milestone

Comments

@tkrotoff
Copy link
Contributor

tkrotoff commented Aug 2, 2018

Currently to use Material-UI with codepen.io, JSFiddle... you have to write (see https://stackoverflow.com/q/50705423):

const { Button, Input } = window['material-ui'];

This is because the output name inside rollup.config.js is 'material-ui':
https://github.com/mui-org/material-ui/blob/8013fdd36d40980ebb8f116f20e2843b781c0c39/packages/material-ui/scripts/rollup.config.js#L10

Instead it should be a name without -, something like 'MaterialUI':

const { Button, Input } = MaterialUI;

rollup.config.js example:

https://github.com/tkrotoff/react-form-with-constraints/blob/b64119bee6ab80c77417a9284a704b380b81bf5e/packages/react-form-with-constraints/rollup.config.js#L19-L27

Related issue: #7621

@oliviertassinari oliviertassinari added this to the v2 milestone Aug 2, 2018
@oliviertassinari
Copy link
Member

@tkrotoff This change sounds good to me. However, it's a breaking change. We gonna need to bump the version to v2. I'm adding it into the milestone 👍

@tkrotoff
Copy link
Contributor Author

tkrotoff commented Aug 3, 2018

This use case is OK: codepen.io => material-ui (with window['material-ui'])
This use case is KO: codepen.io => myLib => material-ui

I don't know how to configure myLib to use window['material-ui'] (no problem of course if material-ui exported a variable MaterialUI).
It's probably not possible, so having a MaterialUI export is not only a "nice to have".

Example code:

@oliviertassinari
Copy link
Member

I don't know how to configure myLib to use window['material-ui']

@tkrotoff We will definitely move forward and address this problem in v2!

@oliviertassinari oliviertassinari added the new feature New feature or request label Aug 4, 2018
tkrotoff added a commit to tkrotoff/react-form-with-constraints that referenced this issue Aug 12, 2018
See UMD package: export MaterialUI variable mui/material-ui#12387
@tkrotoff
Copy link
Contributor Author

@oliviertassinari wow did not expect a release so soon! Can I make a PR to change this: https://github.com/mui-org/material-ui/blob/v3.0.0/packages/material-ui/scripts/rollup.config.js#L10 ?

@oliviertassinari
Copy link
Member

@tkrotoff What do you mean? This change is still planed for v4, in 3-4 months.

@tkrotoff
Copy link
Contributor Author

Je suis un peu perdu : few days ago you were talking about a v2. I saw v3 was just released (could have been a good time to change this) and now talking about a v4.
Anyway, can I make a PR on master? (I guess not, master is for v3 and there is no branch for v4 yet).

@oliviertassinari
Copy link
Member

Yeah sorry for the confusion. v2 focus has just shifted to v4 for Q1 2019.

@oliviertassinari
Copy link
Member

You can definitely open a pull request now on master. We will just wait before merging it :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants