首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将react项目依赖项从节点迁移到apache

将react项目依赖项从节点迁移到apache
EN

Stack Overflow用户
提问于 2017-07-26 18:04:04
回答 1查看 68关注 0票数 0

我已经使用create-react-app创建了一个react应用程序,但是我想将我的应用程序从节点移动到apache,并且我不确定如何处理我的项目的依赖关系。例如,material-ui's文档只在其安装指南中列出了npm。

有没有办法让这些依赖项在apache服务器上工作?

如果是这样,是否需要为每个依赖项单独配置过程?

代码语言:javascript
复制
package.json

{
  "name": "app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "material-ui": "^0.18.6",
    "npm": "^5.1.0",
    "prop-types": "^15.5.10",
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-flexbox-grid": "^1.1.3",
    "react-router": "^4.1.1",
    "react-router-dom": "^4.1.1",
    "react-tap-event-plugin": "^2.0.1"
  },
  "devDependencies": {
    "babel-preset-env": "^1.6.0",
    "eslint": "^3.19.0",
    "eslint-config-airbnb": "^15.0.1",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-jsx-a11y": "^5.1.0",
    "eslint-plugin-react": "^7.1.0",
    "react-scripts": "1.0.10"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-07-26 18:18:22

React应用程序不依赖于任何特定的服务器技术-一旦您的构建运行,它就只是静态JavaScript。

在项目的根目录中运行npm run build将创建一个dist文件夹,其中包含您捆绑的应用程序-您所需要做的就是将该文件夹的内容部署到您的Apache服务器。

See the 'Deploying' section of the create-react-app README for more info.

顺便说一句,如果你一直在生产中使用create-react-app的内置服务器,请不要这样做!这只是为开发而设计的,对于向世界提供你的应用程序来说,它的性能和安全性都不够高。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45323717

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档