facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.84k stars 26.88k forks source link

Lazy loaded component not loading css-module #11360

Open ekokotov opened 3 years ago

ekokotov commented 3 years ago

in DEV mode when lazy chunk evaluated, its styles aren't evaluated. const AuthRoute = lazy(() => import("./auth")) and later: `

} />

`

and If child components contains ' import classes from "./styles.module.scss" ' style doesn't render

in PROD mode (react-scripts build) everything works, but with DEV (react-scripts start)- doesn't

Tested with react-scripts@4.0.2 + sass/node-sass

ekokotov commented 3 years ago

Even If I import CSS module inside lazied component ( import classes from "./styles.module.css ) and navigate to this route - css style not appearing. Only If I refresh the page on this route it works. Seems like in this case it doesn't add necessary