Home > Web Front-end > Front-end Q&A > What to do if the react packaged image path is wrong

What to do if the react packaged image path is wrong

藏色散人
Release: 2023-01-18 15:12:26
Original
1837 people have browsed it

Solution to the wrong path of the react packaged image: 1. Put the build folder directly on IIS; 2. Modify the reference resources in index.html and remove the "/" symbol in front of "/static" You can access the page content.

What to do if the react packaged image path is wrong

The operating environment of this tutorial: Windows 10 system, react18.0.0 version, Dell G3 computer.

What should I do if the path of the react packaged image is wrong?

Solution to image and resource path errors after react packaging

Execute the packaging program After yarn run build

you will see an additional build folder. Just deploy the build folder to the server to access it. If you open index.html directly, an error will be reported and the images and resources cannot be loaded.

I put it directly on IIS and there was no problem after testing.

What to do if the react packaged image path is wrong

# Of course, if you do not use local access, just manually understand and modify the reference resources in index.html. That is to say, if you remove the [/] in front of [/static], you can also access the page content.

Recommended learning: "react video tutorial"

The above is the detailed content of What to do if the react packaged image path is wrong. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template