[英]Angular AoT and Rollup - Error: Runtime compiler is not loaded
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. 在过去的6个月中,我一直在使用Angular构建仪表板应用程序,我使用JiT编译和gulp浏览器同步获得了非常不错的开发工作流程,以便在进行更改时立即获得更新。 Which has worked great.
效果很好。
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. 我很高兴部署了生产版本,但是我遇到了AoT和汇总问题。
I have followed the angular.io guide but got the following 我遵循了angular.io指南,但得到了以下内容
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)
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
. 我还使用了许多可能导致此问题的角度插件(但是我找不到对AoT问题的任何引用),即
MyDatePicker
和MyDateRangePicker
。 I also have a couple of js libraries including D3.js
and momement.js
我也有几个js库,包括
D3.js
和momement.js
So my question is, is there somthing that I am doing wrong that is causing my build.js file to throw runtime compiler is not loading? 所以我的问题是, 我是否在做错什么导致我的build.js文件抛出运行时编译器未加载?
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 如果有人对这个问题有任何见解,那么如果您需要任何特定的代码片段让我知道,将不胜感激,正如我提到的,我的
tsconfig-aot.json
和rollup-config.json
与angular.io基本上相同
Thanks in advance 提前致谢
Big thanks to yurzui in the comments for helping me answer my own question. 非常感谢yurzui在评论中帮助我回答了自己的问题。
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
. 帮助我找到运行时编译器的加载位置的方法是进入生成的build.js,并找到
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. 但是,我不确定为什么loadChildren导致编译器在汇总时加载。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.