首页 > 解决方案 > Some styled-components styles missing after create-react-app build

问题描述

I have this big problem with my create-react-app. I am using styled-components and everything works whene developing but after I build it, some of the styled are missing and the app looks really broken.

It does not happen with the same component everytime. I tried it a month later when my app progressed a lot hoping the problem would solve itself, but it is still happening, just somewhere else.

I noticed that some styles are missing in head of the HTML - first style tag.

enter image description here

I don't know what to do with it, I haven't found anyone with similar problem.

标签: reactjsbuildcreate-react-appstyled-components

解决方案


所以我终于解决了这个问题!

npm list styled-components我发现该软件包使用grid-styled的版本与styled-components我的项目不同。我同步了版本,即使在生产版本中,样式也开始正常运行。


推荐阅读