You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The react config file recommends that developers add references to JSX files:
// If you want to use server-side rendering of React components,
// add all the necessary JavaScript files here. This includes
// your components as well as all of their dependencies.
// See http://reactjs.net/ for more information. Example:
//ReactSiteConfiguration.Configuration
// .AddScript("~/Scripts/First.jsx")
// .AddScript("~/Scripts/Second.jsx");
Is it okay (or even preferable) to refer to the compiled files here instead? In my case, We're compiling JSX files to JS using grunt as part of our build process.
Do we get any performance benefits by referring to the compiled files instead of the JSX files? I assume that React.NET will compile JSX for use on the server side, but I'm curious whether this happens at runtime or at build time.
Thanks so much for building React.NET - it rocks!
The text was updated successfully, but these errors were encountered:
Go ahead and use compiled files there, that's perfectly fine. Just make sure there's no client-specific code in your bundles (eg. definitely don't include jQuery or anything else that touches document in there). I cover this in the Webpack docs on the site and might eventually add docs for Gulp/Grunt too.
Using precompiled files does result in performance benefits. In theory it means JSXTransformer doesn't even need to be loaded at runtime, so you have a lighter footprint. ReactJS.NET isn't quite there yet, using external JS files isn't as performant as it could be at the moment since it will still run your file through JSXTransformer even though it's not needed (since you've already transformed the file yourself). I'll have to think of a smart way to handle this, perhaps a second parameter to AddScript like doNotTransform that just loads the file directly without transformation.
The react config file recommends that developers add references to JSX files:
Is it okay (or even preferable) to refer to the compiled files here instead? In my case, We're compiling JSX files to JS using grunt as part of our build process.
Do we get any performance benefits by referring to the compiled files instead of the JSX files? I assume that React.NET will compile JSX for use on the server side, but I'm curious whether this happens at runtime or at build time.
Thanks so much for building React.NET - it rocks!
The text was updated successfully, but these errors were encountered: