I've got a project that runs fine in the dev server environment, but now I am trying to get it to run on an Apache server. I ran 'npm run build' on my package.json file ("build": "babel-node tools/build.js && npm run open:dist"), and it created a dist folder with the following files:
I placed this folder inside of the htdocs folder in my Apache directory. I double clicked on index.html hoping it would take me to the home page of the app, but nothing happens. Not even an error in the console.
Here's the index.html file I'm using:
<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8"/>
<title>Survey Builder</title>
<link href="./dist/app/main.8286783e52fd295f2f9e5d678a8a2acd.css" rel="stylesheet">
</head>
<body>
<div id="app">
</div>
<script type="text/javascript" src="./dist/app/main.66670fe7523b3b72f307.js"></script>
</body>
</html>
Thanks a bunch in advance!
I'll answer my own question.
*If you're using React and you're deploying on Apache, you need to know that the path where you place your files in Apache must be reflected in your React routes. So, if you place your production ready React files inside of a folder in your htdocs Apache directory, you must also reflect that path in your routes. If you dump your production ready files straight into Apache's htdocs directory, it will work out of the box.
I hope this helps...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With