I am building my application using aspnetcore-spa react-redux boilerplate (can be seen on http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/ )
However the server side rendering takes a lot of time (~30 sec) and I would like to disable it. Can you please tell me how to disable server side rendering without breaking the code?
That template adds the asp-prerender-module
tag helper to the <div id="react-app"...>
tag in Home\Index.cshtml
. If you remove that tag helper you will disable server side rendering.
The tag helper is imported in /Views/_ViewImports.cshtml
:
@addTagHelper "*, Microsoft.AspNetCore.SpaServices"
You can do the bundling from the command line before you run the application with...
> webpack --config webpack.config.vendor.js
> webpack
Steve Sanderson gave a presentation on this at NDC Sydney.
The aspnet-prerender-module
tag helper is part of SpaServices
, which is the basis for all the projects generated by the Yeoman aspnetcore-spa
templates. Therefore, this is how you would enable/disable pre-rendering in any of those templates, including Angular 2
, Aurelia
, Knockout
, and React (with Redux)
. The same would apply to any custom project or template that you create using Node
package aspnet-prerendering
and the aforementioned tag helper.
For Angular 2 project I've solved this by removing asp-prerender-module
attribute from <app>
tag in Index.schtml.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With