I am trying to set up a react application that I have created based on the React Create App template, however I am getting issues when hosting using IIS.
The main page (index.html) appears to load correctly, however the compiled JS appears to fail to load correctly.
I am trying to load the page using IE and as you can see in the image below my non-compiled JS file appears to load correctly, however the compiled JS and CSS seems to fail to load, even though I can confirm that those files exist and with the correct names.
The site is a static site with React Route in use, though the root index.html should serve up a default page.
Before running npm run build
you need to set a hostname in your package.json
. Add this line to the top of your package.json, assuming that your build will be hosted on the root folder of your web server:
"homepage":"http://localhost",
Your folder structure on the web server will look something like this:
public_html <----- assuming this is your root folder on the web server
|
|----index.html
|
|-----static
|
|----css
|----js