Class "displayName" that styled-components offer, does not get applied if MUI is used #33565
Closed
2 tasks done
Labels
package: styled-engine-sc
Specific to styled-components
status: waiting for author
Issue with insufficient information
Duplicates
Latest version
Current behavior 😯
I am using Next JS 12.2.2, it has SWC which now supports styled-components.
Material UI is the latest version.
styled-components is the latest version.
EXAMPLE 1: styled is used from styled-components:
import styled from "styled-components";
export const SCHeroTitle = styled("h2")`
color: pink;
background-color: blue;
`;
This will render correct displayName for the class:
Example 2: using styled from MUI
import {styled} from "@mui/material" or import {styled} from "@mui/material/styles" makes no difference.
export const SCHeroTitle = styled("h2")`
color: green;
background-color: grey;
`;
This will render a generic class name:
next.config.js has "compiler" object set with only this options for the purpose of testing if it works:
Same thing happens if I use Babel instead of SWC so thats not the issue, I was wondering is this intended by MUI - does it do something that prevents displayName to actually get applied and produce sensible class names or is this a bug?
Cheers guys!
Expected behavior 🤔
Class names with displayName applied.
Steps to reproduce 🕹
Steps:
Context 🔦
No response
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: