reactjs - 运行 ReactJS/TailwindCSS/Heroku 时出错:React Refresh 运行时不应包含在生产包中
问题描述
使用 TailwindCSS 在 ReactJS 中处理 webfolio。将其部署到 Heroku,构建成功,但打开应用程序总是给出错误:错误:React Refresh 运行时不应包含在生产包中。
除了没有将tailwindcss配置为可部署之外,真的不确定我做错了什么。我没有任何开发依赖项,它们都是依赖项。
包.json:
"name": "webfolio",
"version": "0.1.0",
"private": true,
"dependencies": {
"@craco/craco": "^6.0.0",
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-brands-svg-icons": "^5.15.1",
"@fortawesome/free-regular-svg-icons": "^5.15.1",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.14",
"@tailwindcss/forms": "^0.2.1",
"@tailwindcss/postcss7-compat": "^2.0.2",
"@testing-library/jest-dom": "^5.11.8",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.6.0",
"autoprefixer": "^9.8.6",
"postcss": "^7.0.35",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"react-spring": "^8.0.27",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco 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"
]
}
}
解决方案
我现在有同样的错误,我知道这篇文章已经有几个月了,但仍然是我的解决方案:
在heroku应用>设置>Webpack下
并且在下一次推送或再次部署时将使其工作。至少它对我有用。
推荐阅读
- java - 显示 :make 编译器输出的 Java 编译程序
- arduino - 尝试从 Arduino 上的 PROGMEM 数组中检索元素时获取垃圾数据
- ubuntu - WSL2下Ubuntu可以上网,但无法访问在线账户,网络设置为空
- java - Netbeans 主类选择器窗口
- r - 替换有符号的单词
- javascript - 我不断收到“无效的挂钩呼叫”。错误
- python - 如何从 groupby 数据框 pandas 中获取索引列表
- python-3.x - 为什么 `exec bash` 在 CI 管道中不起作用?
- javascript - 切换时如何防止我的容器变大?
- r - 如何使用 streamstats 包在 R 中描绘多个分水岭?