Angular 4 RC.4 and .net core server side prerender

2019-04-10 12:34发布

问题:

I have this project https://github.com/damirkusar/AngularMeetsNetCore/tree/AngularRc4 with Angular 4 RC.4 and .net core. I updated it from Beta 8, removed universal stuff. I works without pre-rendering, but not with pre-rendering enabled.

If you enable pre-rendering in this project under: WebApp/Views/Home/Index.cshtml

by adding this to the app element

asp-prerender-module="ClientApp/dist/main-server"

so that the whole thing looks like this:

<app asp-prerender-module="ClientApp/dist/main-server">
    <div class='custom-modal' style="background: white">
        <div class="loader absolut-center"></div>
    </div>
</app>

I am getting the following error:

Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find module '@angular/animations/browser'
at new Error (native)
at Function.Module._resolveFilename (module.js:469:15) [<root>]
at Function.Module._load (module.js:417:25) [<root>]
at Module.require (module.js:497:17) [<root>]
at require (internal/module.js:20:19) [<root>]
at Object.<anonymous> (C:\Users\damir\Code\AngularMeetsNetCore\WebApp\ClientApp\dist\main-server.js:766:18) [<root>]
at __webpack_require__ (C:\Users\damir\Code\AngularMeetsNetCore\WebApp\ClientApp\dist\main-server.js:20:30) [<root>]
at Object.<anonymous> (C:\Users\damir\Code\AngularMeetsNetCore\WebApp\ClientApp\dist\main-server.js:2088:1) [<root>]
at __webpack_require__ (C:\Users\damir\Code\AngularMeetsNetCore\WebApp\ClientApp\dist\main-server.js:20:30) [<root>]
at C:\Users\damir\Code\AngularMeetsNetCore\WebApp\ClientApp\dist\main-server.js:66:18 [<root>]
at Object.<anonymous> (C:\Users\damir\Code\AngularMeetsNetCore\WebApp\ClientApp\dist\main-server.js:69:10) [<root>]
at Module._compile (module.js:570:32) [<root>]
at Object.Module._extensions..js (module.js:579:10) [<root>]
at Module.load (module.js:487:32) [<root>]

Where do I have to include that @angular/animation/browser to SSR working again?