Reputation: 9844
I've grabbed this example ReactJS project > https://github.com/alik0211/pokedex to experiment with Azure devops. When I build the project locally and use npm start
in the build folder the app works fine. This is the path for a file http://localhost:3000/static/js/0.chunk.js`.
But on my Azure environment http://pokedeks.azurewebsites.net/ the server is looking for http://pokedeks.azurewebsites.net/pokedex/static/js/2.c662eb5c.chunk.js. Notice that the `/pokedex/ folder has been added to the path. I'm unsure why this is happening.
I can reproduce it locally by running serve
in the build folder instead of npm start
: http://localhost:5000/pokedex/static/js/2.a7ba4e0c.chunk.js
I've tried adding npm start
to my tasks in the release pipeline but that's also causing errors. So I think the fastest way is to figure out why when using serve
the /pokedex/
folder gets added to the routes?
Upvotes: 1
Views: 4939
Reputation: 9844
I fixed the issue by replacing the homepage
value in my package.json
from "homepage": "https://alik0211.github.io/pokedex/",
to "homepage": "./",
now when I run serve
the paths to the files are correct.
Upvotes: 3