Angular AOT的SystemJS错误:未捕获(在承诺中):TypeError:ctor不是构造函数

时间:2017-09-20 14:03:32

标签: angular systemjs ng-bootstrap angular-compiler-cli angular-compiler

我在应用中使用 Angular 4.4.1 + SystemJS 0.20.19 + NgBootstrap 1.0.0-beta.5 。该应用按照此instructions并具有以下 SystemJS 配置

,在 Angular JIT 模式下工作

meta: { "./*": { "esModule": true } }

我使用了" node_modules / .bin / ngc" -p tsconfig-aot.json 将应用程序编译为 AOT 应用程序。

AOT 应用中,我有 SystemJS map配置,如本问题末尾所示。

在JIT模式下工作的相同应用程序无法在AOT模式下运行,并生成以下错误:

ERROR Error: Uncaught (in promise): TypeError: ctor is not a constructor
TypeError: ctor is not a constructor
    at _createClass (core.umd.min.js:90)
    at _createProviderInstance$1 (core.umd.min.js:90)
    at resolveNgModuleDep (core.umd.min.js:90)
    at NgModuleRef_.get (core.umd.min.js:210)
    at resolveNgModuleDep (core.umd.min.js:90)
    at _createClass (core.umd.min.js:90)
    at _createProviderInstance$1 (core.umd.min.js:90)
    at resolveNgModuleDep (core.umd.min.js:90)
    at NgModuleRef_.get (core.umd.min.js:210)
    at resolveDep (core.umd.min.js:97)
    at _createClass (core.umd.min.js:90)
    at _createProviderInstance$1 (core.umd.min.js:90)
    at resolveNgModuleDep (core.umd.min.js:90)
    at NgModuleRef_.get (core.umd.min.js:210)
    at resolveNgModuleDep (core.umd.min.js:90)
    at _createClass (core.umd.min.js:90)
    at _createProviderInstance$1 (core.umd.min.js:90)
    at resolveNgModuleDep (core.umd.min.js:90)
    at NgModuleRef_.get (core.umd.min.js:210)
    at resolveDep (core.umd.min.js:97)
    at resolvePromise (config.ts:60)
    at resolvePromise (config.ts:60)
    at config.ts:60
    at ZoneDelegate.invokeTask (config.ts:60)
    at Object.onInvokeTask (core.umd.min.js:41)
    at ZoneDelegate.invokeTask (config.ts:60)
    at Zone.runTask (config.ts:60)
    at drainMicroTaskQueue (config.ts:60)
    at <anonymous>

问题:

  1. 我无法知道哪个模块导致此错误。经过多次调试后,错误在加载NgBootstrao NgbModel时出现。如何解决此错误?

  2. 我是否可以使用一些配置设置来查看 SystemJS 在浏览器控制台中加载的模块的进度/日志?

  3. NgBootstrap的SystemJS地图:

         @ng-bootstrap/ng-bootstrap :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
        "@ng-bootstrap/ng-bootstrap/modal/modal-stack":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/modal/modal":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/alert/alert-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/progressbar/progressbar-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/tooltip/tooltip-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/typeahead/typeahead-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/accordion/accordion-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/carousel/carousel-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/datepicker/ngb-calendar":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/datepicker/datepicker-i18n":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/datepicker/ngb-date-parser-formatter":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/datepicker/datepicker-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/dropdown/dropdown-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/pagination/pagination-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/popover/popover-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/rating/rating-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/tabset/tabset-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/timepicker/timepicker-config":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/alert/alert.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/buttons/buttons.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/collapse/collapse.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/progressbar/progressbar.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/tooltip/tooltip.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/typeahead/typeahead.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/accordion/accordion.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/carousel/carousel.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/datepicker/datepicker.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/dropdown/dropdown.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/dropdown/dropdown":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/datepicker/datepicker-input":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
        "@ng-bootstrap/ng-bootstrap/modal/modal.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/pagination/pagination.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/popover/popover.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/rating/rating.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/tabset/tabset.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/timepicker/timepicker.module":  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js , 
        "@ng-bootstrap/ng-bootstrap/index" :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/alert/alert  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/tooltip/tooltip  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/typeahead/highlight  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/typeahead/typeahead-window  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/modal/modal-window  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/modal/modal-backdrop  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/datepicker/datepicker-day-view  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/datepicker/datepicker-month-view  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/datepicker/datepicker  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/datepicker/datepicker-navigation  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/datepicker/datepicker-service  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/datepicker/datepicker-keymap-service  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/popover/popover  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/datepicker/datepicker-navigation-select  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
         @ng-bootstrap/ng-bootstrap/modal/modal-ref  :  /lib/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js ,
    

0 个答案:

没有答案