Angular2 Server-side rendering of main app.module

2019-09-15 02:33发布

问题:

I'm fairly new to Angular2, so apologies if there is an obvious answer or if I'm misunderstanding the way server-side rendering works.

We have an Angular2 project, initially based on Steven Sanderson's .net core template, with server-side rendering etc, but we've upgraded webpack and Angular a couple of times since.

We've had to disable the server-side rendering because we're using devexpress for Angular2 (issue here), alongside a couple of other libraries that don't sit very well with server-side rendering.

Our project has now grown to a significant size, and we'd really like to have the server-side rendering back on due to the perceived performance increase, but we can't remove our dependency on the devexpress libraries.

My question is: would it be possible to split the project into modules, with all the code using the libraries that can't be server-side rendered in lazy-loaded modules, and then pre-render the main app.module?

Thanks in advance, Alex