Jenny
Jenny

Reputation: 23

images not loaded on hosted github page on app using create-react-app

I deployed my repo on github pages at https://jee3153.github.io/WhatToWeather-react/ , it successfully deployed. However, images are not.

And I noticed one thing, all the code is downloaded from my repo. e.g main.2473esf.chunk.js is pointing to: "https://jee3153.github.io/WhatToWeather-react/static/js/main.2473esf.chunk.js" to be downloaded

But images are pointing to: "https://jee3153.github.io/images/weather/dkfjlie.svg" like that.

Is there some kind of rule where to put your image files in? I don't know what I'm doing wrong.

Any help would be appreciated. Thanks

I have looked up documents of create-react-app but no info about images not loading.

.

Upvotes: 1

Views: 1084

Answers (1)

 dandmcd
dandmcd

Reputation: 157

Are the images in your build folder? If they are outside of your SRC during build time, they will not be included during build time. It's recommended to make an assets folder and point to your images in that folder. CRA ignores any files outside of the SRC folder during build time, including the public folder.

Upvotes: 1

Related Questions