Jesse Huang Jesse Huang - 3 years ago 65
Apache Configuration Question

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. For instance, material-ui's documentation only lists npm on its installation guide.

Is there a way to get these dependencies to work on an apache server?

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

Answer Source

React applications don't depend on any particular server technology - once your build has run, it's just static 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.

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

As an aside - if you've been using create-react-app's built-in server in production, don't! That's just designed for development, and is not performant nor secure enough for serving your app to the world.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download