我可以在常规主机上部署ReactJS应用程序吗? [英] Can I deploy my ReactJS app on a regular host?

查看:65
本文介绍了我可以在常规主机上部署ReactJS应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是React的新手,我看过很多指南,人们在这些指南中教您如何在数字海洋,heroku,GitHub Pages,aws等服务上部署React应用。
但是我想知道是否可以部署仅由前端服务(如000webhost或Ipage)组成的React应用(create-react-app)吗?因为有人要我设计一个网站,所以他说他已经在lpage中拥有域名和主机服务。



预先感谢

解决方案

我使用webpack捆绑了我的React应用程式。所以最后,React应用程序将是:




  • 一个捆绑包(如果您使用动态捆绑包加载,则很少(可能没有),这仅仅是一个javascript文件

  • 您的index.html,其中在主体末尾包含此文件

  • 和您可以原则上设置的.css文件(或包含几个文件的单独文件夹)并包含在index.html的顶部。



关于.css,有几种更好的方法



因此,您只需将这三样东西放到服务器上,即可在index上找到应用程序。



html。



PS不知道什么是Ipage,还没有使用create-react-app。


I'm new to React, and I've seen many guides where people teach you how to deploy your react app on services like digital ocean, heroku, GitHub Pages, aws. But I'm wondering if I can deploy my React app (create-react-app) which consists of only front end in a host service like 000webhost or Ipage? Because a person wants me to design a website, and he says that he already has a domain name and a host service in lpage.

Thanks in advance

解决方案

I use webpack to bundle my react app. So at the end react app will be:

  • one bundle (rarely more if you use dynamic bundle loading - probably not), that is just a javascript file
  • your index.html that includes this file at the end of body
  • and your .css that you can set in principle in one file (or separate folder with several files) and include at the top of your index.html

Regarding .css there are several better ways how to include, but you can likely start with simple setup as mentioned above.

So you just put these 3 things on your server, and your app is available at index.html.

P.S. Don't know what is Ipage, and haven't worked with create-react-app.

这篇关于我可以在常规主机上部署ReactJS应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆