Skip to content

Doesn't play well with material-ui v4 #224

@williammetcalf

Description

@williammetcalf

In the newest major update of Material-UI, there is a styled function that is somewhat similar to styled-components. When importing it like:

import { styled } from "@material-ui/styles"

the following error is thrown:

[0] const CloseButton = styled(IconButton)({
[0] ^
[0] 
[0] TypeError: styles_1.styled(...).withConfig is not a function
[0] 
[0]   57 | };
[0]   58 | 
[0] > 59 | const CloseButton = styled(IconButton)({
[0]   60 |   position: "absolute",
[0]   61 |   top: 10,
[0]   62 |   right: 10,
[0] 
[0]     at Object../src/common/SomeComponent (/.../SomeComponent.tsx:59:1)

However when the imported variable's name is changed, it works. example:

import { styled as matStyled } from "@material-ui/styles"

As best as I can tell this is happening because this babel plugin is seeing the styled import and transforming it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions