[英]Migrating react project dependencies from node to apache
I have created a react application using create-react-app but I want to move my application from node to apache and I'm not sure how to handle my project's dependencies. 我已经使用create-react-app创建了一个React应用程序,但是我想将我的应用程序从node移到apache,我不确定如何处理项目的依赖关系。 For instance, material-ui's documentation only lists npm on its installation guide.
例如, material-ui的文档仅在其安装指南中列出了npm。
Is there a way to get these dependencies to work on an apache server? 有没有办法让这些依赖关系在apache服务器上工作?
If so, would it be a separate configuration process for each dependency? 如果是这样,那么每个依赖项将是一个单独的配置过程吗?
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 applications don't depend on any particular server technology - once your build has run, it's just static JavaScript. React应用程序不依赖于任何特定的服务器技术-构建运行后,它只是静态JavaScript。
Running npm run build
in your project's root will create a dist
folder with your bundled application inside - all you need to do is deploy the contents of that folder to your Apache server. 在项目的根目录中运行
npm run build
将创建一个dist
文件夹,其中包含捆绑的应用程序-您要做的就是将该文件夹的内容部署到Apache服务器。
See the 'Deploying' section of the create-react-app
README for more info. 有关更多信息,请参见
create-react-app
自述文件的“部署”部分。
As an aside - if you've been using create-react-app
's built-in server in production, don't! 顺便说一句-如果您在生产中一直使用
create-react-app
的内置服务器,请不要! That's just designed for development, and is not performant nor secure enough for serving your app to the world. 这只是为了开发而设计的,其性能和安全性不足以将您的应用程序推向世界。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.