0

I have created a React application OptionsReact using typescript and create-react-app. Then I build the application by running

npm run build

I create in IIS a Website OptionsReact and point it to the build folder, application works and I can see it in the browser.

But when I create an Application OptionsReact under an existing Website, the page in the browser is blank, it seems as if the server doesn't run javascript.

any ideas how can I fix it?

1 Answer 1

1

To host react application under the site in iis you could follow the below steps:

1)create an application in iis with the build folder.

enter image description here

2)open the index.html page which is located at the build folder.

enter image description here

3)convert all the links as below:

Convert all absolute links to relative ones.

<link href="/static/css/main.584f321a.chunk.css" rel="stylesheet">

to

<link href="./static/css/main.584f321a.chunk.css" rel="stylesheet">

4)assign the iis_iusrs and iusr permission to the site and application root folder (e.g. app2)

5)refresh the site after doing changes and browse the site.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

I checked index.html, all links have a dot in front of the uri. thanks anyway

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.