我有这样的问题,在GitHub上部署我的React应用后,它只能在我的PC上工作。当我打开链接时,我的应用程序在哪里必须使用我的PC或LapTop部署。联系 - 它的工作原理,但当我试图打开它与手机或发送此链接给我的朋友 - 有一个空的页面(与我的背景)。那么如何解决这个问题呢?
有我的存储库 联系
我的package.json的代码
{
"name": "worktests",
"version": "0.1.0",
"private": true,
"homepage": "https://dmitriykulikovskiy.github.io/MyWeatherForecast",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.13.0",
"@fortawesome/free-solid-svg-icons": "^5.13.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"bootstrap": "^4.5.0",
"font-awesome": "^4.7.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-redux": "^7.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"shortid": "^2.2.15"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^2.2.0",
"node-sass": "^4.14.1",
"sass-loader": "^8.0.2"
}
}
问题是这样的 行:
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
在 store.jsx
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
只有当你的浏览器上安装了Redux Web Tools时才可以使用。你的应用程序也不能在本地运行。然而,当我安装了扩展后,它在本地和您的部署站点上都能正确运行。
这个 这条线可能有助于找到正确使用 composeEnhancers
在生产中,你不应该依赖开发工具插件填充的属性进行调试。理想情况下,在生产中,你不应该依赖开发工具插件填充的属性进行调试,而应该使用 compose
直接从 redux
.