kumar
kumar

Reputation: 9387

running react bundle in Azure web app does not load json file

After building my react project it creates a bundle of files .js .json and index.html files.

I created a windows web app in azure.

When I deploy the bundle the page loads but none of the .json files do not load. I have seen other examples they talk webconfig changes but since this is a react project that does not apply.

Upvotes: 0

Views: 233

Answers (1)

Jagadeesh Govindaraj
Jagadeesh Govindaraj

Reputation: 8285

I manually add a web.config in 'dist/prod' with the following to make it work.

<?xml version="1.0"?>
 <configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".json" mimeType="application/json" />
     </staticContent>
    </system.webServer>
 </configuration> 

try it. Note this for only static json files if your going to look dynamic content.you need add handler in config.files

Upvotes: 3

Related Questions