I post question about index.html showing empty page, after npm run build(react).
I've done a lot of googling, but I don't think I found the right answer. Can you find a solution that fits my situation?
First of all, I tried this.
- adding in package.json
homepage : "./" or "." or "absolute file PATH"
And my package.json is...
{
"name": "client",
"homepage": "./",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.4",
"bootstrap": "^5.1.0",
"dotenv": "^10.0.0",
"html-react-parser": "^1.3.0",
"http-proxy-middleware": "^2.0.1",
"quill": "^1.3.7",
"react": "^17.0.2",
"react-bootstrap": "^2.0.0-beta.6",
"react-dom": "^17.0.2",
"react-ga": "^3.3.0",
"react-html-parser": "^2.0.2",
"react-icons": "^4.2.0",
"react-kakao-maps-sdk": "^1.0.3",
"react-loading-skeleton": "^3.0.1",
"react-quill": "^1.3.5",
"react-redux": "^7.2.5",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3",
"react-use-clipboard": "^1.0.7",
"redux": "^4.1.1",
"redux-devtools-extension": "^2.13.9",
"redux-persist": "^6.0.0",
"redux-promise": "^0.6.0",
"redux-thunk": "^2.3.0",
"use-react-router": "^1.0.7",
"web-vitals": "^1.1.2"
},
"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"
]
}
}
and my app.js file is...
import React, { useEffect } from "react";
import { Switch, Route, BrowserRouter } from "react-router-dom";
//import some components omitted
const App = () => {
// some logical code
return (
<BrowserRouter history={history}>
<Switch>
<Route path="/contact" component={Contact} exact />
<Route path="/withdrawal" component={Withdrawal} exact />
{* and some Route code omitted *}
<Route path="*" component={ErrPage} />
</Switch>
</BrowserRouter>
);
};
export default App;
What's the problem with my code? Or what setting should I do more?
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire