79594908

Date: 2025-04-27 09:55:46
Score: 0.5
Natty:
Report link

What happens in React is that when you execute 'npm run build' command, it replaces %PUBLIC_URL% with ./ or the homepage(if specified) in package.json field. Changing %PUBLIC_URL% to another path made the browser look for images and other files in the wrong location. Changing it back to %PUBLIC_URL% will not solve the issue as browser will be loading files from its cache.

  1. You need to first clear browser cache by opening DevTools → Right-click Reload button → Choose Empty Cache and Hard Reload

  2. Delete the build/ folder and rebuild -

    npm run build
    
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Starts with a question (0.5): What
  • Low reputation (1):
Posted by: mayankdv