Home > Article > Web Front-end > What to do if the react packaged image path is wrong
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.
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.
# 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!