小编Tim*_*ens的帖子

Angular 2没有CompilerFactory的提供程序

我在我的Ahead-of-Time编译应用程序中收到此错误:

Error: No provider for CompilerFactory!
    at NoProviderError.BaseError [as constructor] (http://localhost:5050/app.js:2413:26)
    at NoProviderError.AbstractProviderError [as constructor] (http://localhost:5050/app.js:2612:19)
    at new NoProviderError (http://localhost:5050/app.js:2651:19)
    at ReflectiveInjector_._throwOrNull (http://localhost:5050/app.js:4637:22)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:5050/app.js:4671:28)
    at ReflectiveInjector_._getByKey (http://localhost:5050/app.js:4625:28)
    at ReflectiveInjector_.get (http://localhost:5050/app.js:4385:24)
    at PlatformRef_._bootstrapModuleWithZone (http://localhost:5050/app.js:10924:64)
    at PlatformRef_.bootstrapModule (http://localhost:5050/app.js:10910:24)
    at http://localhost:5050/app.js:64873:22
Run Code Online (Sandbox Code Playgroud)

使用NGC生成应用程序以生成.ngfactory文件,然后使用不同main文件生成TSC 以获取JS,然后汇总w/Babel以完成构建.遵循指南非常接近.

这是我的main.prod.ts:

import "reflect-metadata";

import { enableProdMode } from "@angular/core";
import { platformBrowser } from "@angular/platform-browser";
import { AppModuleNgFactory } from "./app.module.ngfactory";

enableProdMode();

platformBrowser().bootstrapModule(<any> AppModuleNgFactory)
Run Code Online (Sandbox Code Playgroud)

javascript angular-compiler-cli angular

8
推荐指数
1
解决办法
2862
查看次数

标签 统计

angular ×1

angular-compiler-cli ×1

javascript ×1