Search code examples
htmlcssreactjsbuildpath

ReactJS build is putting a '/' infront of every path, and it's making all css and images fail to load


As shown in the linked image,

After running "npm run build", all of the paths begin with a "/", and this is the case for every single image and css link.

As soon as I remove the "/" it displays without a problem.

Why is it set to the wrong path, and how do I fix this? As I cannot find every item in the files.

index.html with static paths


Solution

  • Are you hosting your app on a sublink? like /something/app? If so, take a look at Serving the Same Build from Different Paths