2
votes

According to How to upgrade a React project built with create-react-app, I have updated react-scripts from v1.1.4 to v3.4.3. However, there's a question on homepage that I cannot solve properly.

In previous package.json, I have "homepage": "/temp_project/resources" After I've updated react-scripts to v3.4.3, everything works fine except when npm start ("start": "react-scripts start"), path will becomes http://localhost:3000/temp_project/resources which is not expected. (Expected to have http://localhost:3000/ ) Hot fix = manually change the path to http://localhost:3000/ everytime

If I change "homepage": "/temp_project/resources" to "homepage": "/", then my http://localhost:8080/temp_project (index page) becomes a blank page. And my npm start ("start": "react-scripts start") work fine.

What should I do?? Sorry if it's a fool question. Thank you.

Supplement:

it's a maven spring boot project using eirslett/frontend-maven-plugin and maven-resources-plugin

package.json

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "proxy": "http://localhost:8080",
  "homepage": "/temp_project/resources",
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
1

1 Answers

0
votes

Can you try "homepage": "." or maybe "homepage": "./" for that matter... let me know if it helps