将 react 项目依赖项从 node 迁移到 apache

Migrating react project dependencies from node to apache

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

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

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

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"
  }
}

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

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

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

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