-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deployment with Surge or similar #84
Comments
I +1ed, but please consider that it puts a dependency on a third party service. maybe gh-pages? |
So good! We've thought about adding upload to gh pages as well. Need to figure out how to integrate it with the experience. |
also possible - ngrok, if you don't want to 'host' elsewhere |
@threepointone Very good point—Surge recently had issues with Digital Ocean taking their sites down, though the actual product and team are very good and helpful. GitHub pages may work as well but I've actually never used them ha, I just want easy deployment :-) Whatever works. |
I vote for GH pages. |
the You can check the output here: NOTE: I'm a beginner and don't know the implications of doing this |
Woah, this is growing really fast, I'll just reference a PR for this #94 |
Won’t this break single page apps with client side history API routing though? |
Yes, indeed, @gaearon! |
Hey friends, I put some thought into this discussion and wrote a blog post about how to deploy this project to Netlify. I am sure the same steps can be made with surge and other things like Firebase as well. Netlify can perform continuous deploys similar to GH pages pretty easily, app.netlify.com is React app hosted with netlify 🐶 + 🍔 = 😎 As far as the routing, we have a solution in our documentation for that here. We do the following in a
|
This works when not using React Router. As soon as React Router is introduced, things get strange! As @gaearon mentioned in another issue, this has to do with The assets do get loaded, just nothing renders on the page. So I guess for now this will not work as a static website with React Router. I have been trying everything! |
@selfup, have you tried the redirect method mentioned by @bdougie? There's also this repository explaining the "hack" https://github.com/rafrex/spa-github-pages However, people are baking a pretty good solution right here: #94, have you checked it? |
I will check the spa-github-pages link. I have tried the publicPath route, but maybe I did something wrong! I'll keep at it 👍 Currently I push the build folder to gh-pages:
|
So I used the #94 solution, and my assets are loading just fine now on gh-pages! For the bundled css it points to: So it knows where to grab stuff. However, nothing is rendering. No errors in the console. Could it be my Router setup? If this is because of the webpack build, I am wondering how to fix this. If I do: <div id="root"><!-- react-empty: 1 --></div> |
Ok so if you remove browser history it works on gh-pages. However, that is not the best approach (wicked looking url). How could this work with browser history? |
GH pages won’t really work well with browser history (and IMO that’s fine). |
@gaearon Agreed. Yea I mostly use gh-pages for fun. Deploying to a VPS will be fine once MVP is proven. |
I tried the Github pages deployment and the command
threw an error saying
Should we be including that command by default? I realize that that's absolutely fine and I can just skip it then, but not sure if others are going to realize that… |
I also just noticed that it fails when using a custom subdomain with GH Pages, since then the URL is |
I was trying to figure out a universal set of commands for replacing a remote branch but couldn't quite manage them. Maybe there's something like "delete if exists"? Subtree push doesn't seem to have a "force" option. Alternatively we could display commands that delete everything except build, move its files in the root, and do regular force push. I'm not sure I understand your point about custom domain. How is this different from regular GH Pages? If you put |
To be clear, GH Pages (regular or custom domain) would only work in master and only if you specify |
Ah, that's my problem. 👍 didn't realize a fix for this was already in! |
If you specify |
Right now I just ran the program, did
npm run build
, and thensurge -p build
. Five seconds later I can show this to others:https://highfalutin-sofa.surge.sh
I can also customize the URL to whatever I want (if available).
I feel like this is a great feature that could be added—one command, no config deployments. Imagine you're learning React and did something cool and want to share it but have no idea what Heroku, Digital Ocean, etc. are. This did it for you!
surge
can be added as a dev dependency and adeploy
script can be added that would benpm run build && surge -p build
.What do you think?
The text was updated successfully, but these errors were encountered: