So I obviously can't access localhost:3000 on my server, so I wanted to test it via the ip address with subfolders eg (192.0.1.168/reactjs). I've run npm run build
and I've gone into the build folder, but it displays an empty page.
Am I missing something?
npm run build
compiles your source files into a minified version of your app. This version can be found inside your /build directory.
If you want to serve this compiled version, you need to setup a webserver. Most common around are "Apache" and "nginx". Configure your webserver to use your /build directory as the root directory.
For configuration advices of your webserver you should read the documentation of the choosen one.
Solved it by adding "homepage": "/reactjs/build",
to package.json
. Didn't work before as I didn't put build
in it as well.
So the next question is, how do I change the build location, so that I can access it via www.website.com/reactjs
rather than www.website.com/reactjs/build
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.