Angular 4 RC.4和.net核心服务器端预渲染

时间:2017-03-18 11:04:03

标签: angular asp.net-core serverside-rendering angular4

我有Angular 4 RC.4和.net核心这个项目https://github.com/damirkusar/AngularMeetsNetCore/tree/AngularRc4。我从Beta 8更新了它,删除了通用的东西。我的工作没有预渲染,但没有启用预渲染。

如果您在此项目中启用预渲染: WebApp / Views / Home / Index.cshtml

将此添加到app元素

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

这样整个事情看起来像这样:

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

我收到以下错误:

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>]

我必须在哪里将@ angular / animation / browser包含在SSR再次工作中?

0 个答案:

没有答案