How to debug angular 2 aot failures

人走茶凉 提交于 2019-12-01 05:43:33

Are you by any chance using: angular2-logger? I've had the exact same error and found out even though I don't actually use the Options I had to provide them for --aot to work.

Eg: In your AppModule have to following import:

import {Logger, Options} from "angular2-logger/core";

Then in you list of providers make sure you add Options:

providers: [
  Logger,
  Options // <-- this is key
]

That made the sure AOT included "Options".

Now, how did I find out? The error gives you the hint it cant find "Options". So I used the Developer Tools to look at the generated sources using the sourceMaps (I looked at main.bundle.js). There I searched for the string "Options" and the only hit gave me also the final hint:

__WEBPACK_IMPORTED_MODULE_9_angular2_logger_core__["Options"])

Now thate made me realize after looking at the docs I had to provide the Options as well.

Hope this helps. :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!