首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >React与开发非常不同。

React与开发非常不同。
EN

Stack Overflow用户
提问于 2022-03-09 16:56:00
回答 1查看 115关注 0票数 0

谢谢你想帮我!

当我构建我的React应用程序时,它看起来与开发模式非常不同。我使用serve -s build来观察应用程序何时生成。但在我的在线Digitalocean服务器上,它看起来和开发中的不一样。因此,它可能与反应或它是如何建造的有关。这是一种发展模式:

这就是建造它的时候:

因此,它看起来CSS或Javacript没有正确编译。这是我的package.json

代码语言:javascript
复制
{
  "name": "websitedominique",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.7.1",
    "@emotion/styled": "^11.6.0",
    "@material-ui/core": "^4.12.3",
    "@material-ui/icons": "^4.11.2",
    "@mui/icons-material": "^5.2.1",
    "@mui/material": "^5.4.2",
    "@mui/styled-engine-sc": "^5.4.2",
    "@react-hook/mouse-position": "^4.1.3",
    "@rehooks/window-size": "^1.0.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "concurrently": "^7.0.0",
    "cors": "^2.8.5",
    "express": "^4.17.3",
    "framer-motion": "^4.1.17",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router": "^6.0.2",
    "react-router-dom": "^6.0.2",
    "react-scripts": "4.0.3",
    "styled-components": "^5.3.3",
    "swiper": "^6.8.4",
    "use-react-dimensions": "^2.0.1",
    "web-vitals": "^1.0.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "nodemon": "^2.0.15"
  }
}

我希望有人能帮我这个忙。谢谢你的帮助!

EN

回答 1

Stack Overflow用户

发布于 2022-03-10 10:10:01

您应该在根目录中添加一个.env文件,并添加:REACT_APP_SC_DISABLE_SPEEDY=true

样式化的组件库使用所谓的“快速模式”在生产中注入样式。你可以在谷歌上搜索更多信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71413137

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档