Reputation: 31
here's my github project https://github.com/MangoYumm/Fashion
I have my main index.html public/index.html app.js from src/app.js controls the frontend , which is made of Header,Body,Footer and all these have images in them. "npm run start" works fine and everything is displayed when I run public/index.html.
now when I use "npm run build" , and run build/index.html , it doesn't show all the images. Only the F icon in Header is shown, and the stars in part1 of Body. How to fix that?
Upvotes: 0
Views: 829
Reputation: 31
I downloaded the repo and tried to run the project both with start and after building it.
Once you run: npm run build
you then need to run the following:
serve -s build
( you may need to install it globally if it is not installed ).
React uses a variable called PUBLIC_URL
to get the path to your resources it is the root path of your app. Opening just the index.html will not work as expected.
P.S.: no need to write npm run start
you can also do this: npm start
.
Hope it works!
Upvotes: 1