Angular AoT和汇总-错误:未加载运行时编译器 [英] Angular AoT and Rollup - Error: Runtime compiler is not loaded

查看:453
本文介绍了Angular AoT和汇总-错误:未加载运行时编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的6个月中,我一直在使用Angular构建仪表板应用程序,我使用JiT编译和gulp浏览器同步获得了非常不错的开发工作流程,以便在进行更改时立即获得更新。

I have a been building a dashboard application using Angular for the last 6 months in that time I have had a really nice development workflow using JiT compilation and gulp browser sync to get instant updates when I make changes. Which has worked great.

我已经很高兴部署了生产版本,但是,我遇到了AoT和汇总问题。

I have come to the point where I am happy to deploy a production version, however, I have run into issues with AoT and rollup.

我遵循了angular.io指南,但得到了以下内容

I have followed the angular.io guide but got the following

ERROR Error: Uncaught (in promise): Error: Runtime compiler is not loaded
Error: Runtime compiler is not loaded
    at _throwError (build.js:5036)
    at Compiler.compileModuleAsync (build.js:5065)
    at MergeMapSubscriber.project (build.js:34798)
    at MergeMapSubscriber._tryNext (build.js:30450)
    at MergeMapSubscriber._next (build.js:30440)
    at MergeMapSubscriber.Subscriber.next (build.js:425)
    at ScalarObservable._subscribe (build.js:846)
    at ScalarObservable.Observable._trySubscribe (build.js:708)
    at ScalarObservable.Observable.subscribe (build.js:696)
    at MergeMapOperator.call (build.js:30415)
    at _throwError (build.js:5036)
    at Compiler.compileModuleAsync (build.js:5065)
    at MergeMapSubscriber.project (build.js:34798)
    at MergeMapSubscriber._tryNext (build.js:30450)
    at MergeMapSubscriber._next (build.js:30440)
    at MergeMapSubscriber.Subscriber.next (build.js:425)
    at ScalarObservable._subscribe (build.js:846)
    at ScalarObservable.Observable._trySubscribe (build.js:708)
    at ScalarObservable.Observable.subscribe (build.js:696)
    at MergeMapOperator.call (build.js:30415)
    at resolvePromise (zone.js:769)
    at resolvePromise (zone.js:740)
    at zone.js:817
    at ZoneDelegate.invokeTask (zone.js:424)
    at Object.onInvokeTask (build.js:6048)
    at ZoneDelegate.invokeTask (zone.js:423)
    at Zone.runTask (zone.js:191)
    at drainMicroTaskQueue (zone.js:584)
    at ZoneTask.invoke (zone.js:490)

我还使用了许多不同的角度插件可能 导致了该问题(但是我找不到对AoT问题的任何引用),即 MyDatePicker MyDateRangePicker 。我也有几个js库,包括 D3.js momement.js

I am also using a number of different angular plugins that could be causing the issue (however I couldn't find any reference to an AoT issue) namely MyDatePicker and MyDateRangePicker. I also have a couple of js libraries including D3.js and momement.js

所以我的问题是,我在做错什么东西导致我的build.js文件抛出运行时编译器未加载吗?

如果有人对这个问题有任何见解,那么如果您需要任何特定的代码片段,请告诉我,将不胜感激,正如我提到的 tsconfig-aot.json rollup-config.json 本质上与angular.io中的相同。

If anyone has any insight into the issue it would be greatly appreciated if you require any specific code snippets let me know, as I mentioned my tsconfig-aot.json and rollup-config.json is essentially the same as in angular.io

预先感谢

推荐答案

在此感谢yurzui帮助我回答了自己的问题。

Big thanks to yurzui in the comments for helping me answer my own question.

帮助我找到运行时编译器的位置的方法是进入生成的build.js,并找到 compileModuleAsync 的用法。在删除它的使用后,我在 loadChildren 方法中找到了它。项目在浏览器中成功运行。

The approach that helped me find where the runtime compiler was being loaded in was to go into my generated build.js and finding the use of compileModuleAsync. I found it within the loadChildren method, after removing its use the project ran successfully in the browser.

但是,我不确定为什么loadChildren会导致编译器在汇总中加载。

However, I am not sure as to why loadChildren is causing the compiler to load in on rollup.

希望这会有所帮助。

这篇关于Angular AoT和汇总-错误:未加载运行时编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆