Relative path in index.html after build Relative path in index.html after build reactjs reactjs

Relative path in index.html after build


// package.json{  "name": "your-project-name",  "version": "0.1.0",  "homepage": "./", # <--- Add this line ----  ...}

Run npm run build again.

This will change the path to ./, which is the relative path of your project.


I encountered a similar issue and resolved it by setting "homepage": "./" in package.json

I found this solution here https://github.com/facebook/create-react-app/issues/165


If you're using webpack, you can try setting publicPath to ./

You can read more about it here.