javascript - react-table styled-components 从 express js 服务器作为静态应用程序加载时会丢失样式
问题描述
我有一个独立工作的反应应用程序,它使用样式组件。我正在使用“styled-components”,“react-table”版本“^4.4.1”,
下面描述了我的 react 生产构建的内容。我没有 app.js 或 index.js 文件
https://create-react-app.dev/docs/production-build/
对于生产部署,我将其移至 express 服务器,并且我在 app.js 中有以下 express 配置来加载反应应用程序。
// 从 React 应用程序提供静态文件
app.use(express.static(path.join(__dirname, 'client/build')));
虽然内联样式可以正常工作,但某些样式组件样式不起作用。
我按照以下链接进行操作,但不知道如何将其应用于我的应用程序,该应用程序没有共享样式的组件,并且每个组件都有自己的
解决方案
推荐阅读
- docker - Docker-entrypoint.sh 导致带有 golang 的 ARM 映像“未找到”
- java - 错误:无法访问 jarfile - 运行 bfg.jar 时
- javascript - 使用前未定义的前向参考任务
- java - 关于 com.jcraft.jsch.JSchException: UnknownHostKey: xycom 的查询。DSA 密钥指纹是“ac:ew:....”
- node.js - create-react-app + npm start - 'react-scripts' 未被识别为内部或外部命令
- c++ - 复杂类型的 QVector 与 std::vector
- python - Django-Private-Chat in , TemplateDoesNotExist at /dialogs/
- python - Numpy:如何用一维数组索引二维数组?
- html - 背景颜色在一个位置不稳定
- r - 决策树 rpart 通过插入符给出 ROC 为 0.5