UMD package: export MaterialUI variable
See original GitHub issueCurrently 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:
Related issue: #7621
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
SSR does not work when MaterialUI is external resource
I'm using webpack to bundle my project, as many others does. However I want some libs to be external and loaded from unpkg....
Read more >How should material-ui be externalized when bundling with ...
Put this method above your module.exports in webpack.config. function externalForMaterialUi(context, request, callback) { if (/@material-ui.
Read more >material-ui/core/CHANGELOG.md - UNPKG
- ⚛️ A first step toward converting all the demos to React Hooks (#13873) @adeelibr. 124, - And many more bug fixes and...
Read more >@mui/material | Yarn - Package Manager
MUI System is a collection of CSS utilities to help you rapidly lay out custom designs. ... Installation. Material UI. Material UI is...
Read more >Learn the basics of the JavaScript module system and build ...
UMD essentially creates a way to use either of the two, while also supporting the global variable definition. As a result, UMD modules...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 👍
You can definitely open a pull request now on master. We will just wait before merging it 😃.