0

I want to deploy ReactJS App that should be run from usb stick. Is it enough to copy all files from "Build" directory to stick after npm run build command in terminal? It seems OK for me after I fixed some paths manually. I am asking is this metod OK or there is better way to deploy apps for such usage?! Thanks in advance!

i.rijad
  • 36
  • 6

1 Answers1

1

Yes, all files from build directory is enough to deploy a react app. it's about the web server you used for this purpose. Read this links, may to help you:

  1. https://create-react-app.dev/docs/deployment/
  2. https://dev.to/xarala221/the-easiest-way-to-deploy-a-react-web-application-2l8a
Ali Askari
  • 341
  • 3
  • 7
  • I have major issue.. in this case Router doesn't work! When I try to navigate I get following error: ... 'pushState' on 'History': A history state object with URL.. – i.rijad Nov 29 '20 at 21:31
  • How did you run the project after build from dist directory? – Ali Askari Nov 30 '20 at 19:54
  • I just copied content from Build directory and opened index.html.. I didn't use any server because, as I noted, it should be running from USB memory stick! – i.rijad Dec 02 '20 at 07:32
  • 1
    When you run react app with `file://...` protocol, you'll get this error. Read this [link](https://stackoverflow.com/questions/55881641/how-to-fix-uncaught-domexception-failed-to-execute-pushstate-on-history) – Ali Askari Dec 02 '20 at 08:37
  • This means I can't run React app with routes properly without server :/ I have to find workaround for routing. – i.rijad Dec 02 '20 at 11:56