question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UMD package: export MaterialUI variable

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
oliviertassinaricommented, Aug 2, 2018

@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 👍

1reaction
oliviertassinaricommented, Aug 28, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found