我已经使用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"
}
}发布于 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的内置服务器,请不要这样做!这只是为开发而设计的,对于向世界提供你的应用程序来说,它的性能和安全性都不够高。
https://stackoverflow.com/questions/45323717
复制相似问题