Reputation: 18
I'm building a react website. The goal for it is to be able to simply put the finished website on a USB key and be able to use it on a computer without any internet access.
I'm using react v16.6. I've already tried to simply open the build/index.html
file but I received a few Not allowed to load local resource: file:///static/...
and the page was blank.
This projects is using a JSON file, pictures and videos.
I don't really know where I should go from here to be able to this.
Thanks for any help.
Upvotes: 0
Views: 36
Reputation: 4257
Based on some of your details, I'm assuming you're using create-react-app.
If you read the error message or look in build.html you'll see that the built site is trying to load your javascript from /build/static/js/...
. This would effectively be trying to load the files from the root of the file system, not the current directory. You can set "homepage": "."
in package.json and the built site will load the files correctly. This is documented in the message that you get when you do npm run build
, which also links to https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#deployment for more details.
Upvotes: 1