Answer the question
In order to leave comments, you need to log in
React image path breaking?
I use facebook/create-react-app , but when I run npm run build , in the build folder, when opening index.html, css and js were not found immediately: /C:/static/css/main.27366ef3.css:1 Failed to load resource : writes such a path.
If you delete in Index.html / before the static , then the js and css themselves become visible, but then there are no pictures, during development all the ways worked. I import as indicated in the documentation, I did not find the answer to my question in more than 1 English-language source. also in the webpack documentation itself, who came across?
import React from 'react';
import logo from './logo.png'; /
function Header() {
// Import result is the URL of your image
return <img src={logo} alt="Logo" />;
}
export default Header;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question