I’m developing a ReactJS.NET application that makes heavy use of server side rendering (tutorial here). It’s built on the latest ASP.NET 5 MVC 6 stack and runs as an Azure Web App. It all seemed to be working just fine locally but when deployed to Azure everything blew up.
After several hours of figuring out what was happening here’s what I found:
- ReactJS.NET uses different JS engines based on what’s available on your machine
- Locally I was running MSIE ChakraJsRt (comes with Microsoft Edge browser)
- Azure was running another MSIE engine (probably Classic JS)
Damn, there had to be a way around. And there was.
Running V8 locally
First let’s force ReactJS.NET to only run in the V8 engine (by disallowing MSIE engines). In your Startup.cs set the value for AllowMsieEngine to false:
Install-Package React.AspNet -IgnoreDependencies
If you try running your application now it should run just fine using the V8 engine!
Running V8 in Azure
The last step is to wire this as a post publish script in project.json: