2017-05-21 5 views
0

Ich versuche AOT in mein eckiges Projekt zu integrieren, also folgte ich Angular.io, um das zu tun, der AOT-Ordner und die Dateien werden erfolgreich ohne Fehler generiert, nachdem ich folgendes ausgeführt habe Befehl:AOT - Ladefehler app.module.ngfactory wurde nicht gefunden

"node_modules/.bin/ngc" -p tsconfig-aot.json 

aber wenn ich die Anwendung in einem Browser ausgeführt ich folgende Fehlermeldung in der Konsole bin immer:

Fetch error: 404 Not Found 
Instantiating 
http://localhost:55019/aot/wwwroot/typescript/modules/app.module.ngfactory  
Loading http://localhost:55019/typescript/main.js 
Loading app 
at system.src.js:1500 
at ZoneDelegate.invoke (zone.js:391) 
at Zone.run (zone.js:141) 
at zone.js:817 
at ZoneDelegate.invokeTask (zone.js:424) 
at Zone.runTask (zone.js:191) 
at drainMicroTaskQueue (zone.js:584) 
at <anonymous> 

ich bin sicher, dass ich in meinem AOT Ordner app.module.ngfactory habe.

hier ist meine package.json Datei

{ 
    "name": "angular-quickstart", 
    "version": "1.0.0", 
    "scripts": { 
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings" 
    }, 
    "licenses": [ 
    { 
     "type": "MIT", 
     "url": "https://github.com/angular/angular.io/blob/master/LICENSE" 
    } 
    ], 
    "dependencies": { 
    "@angular/common": "4.1.3", 
    "@angular/compiler": "4.1.3", 
    "@angular/compiler-cli": "4.1.3", 
    "@angular/core": "4.1.3", 
    "@angular/forms": "4.1.3", 
    "@angular/http": "4.1.3", 
    "@angular/platform-browser": "4.1.3", 
    "@angular/platform-browser-dynamic": "4.1.3", 
    "@angular/router": "4.1.3", 
    "@angular/upgrade": "4.1.3", 
    "angular-in-memory-web-api": "0.3.2", 
    "bootstrap": "3.3.7", 
    "angular2-jwt": "0.2.3", 
    "core-js": "2.4.1", 
    "reflect-metadata": "0.1.10", 
    "rxjs": "5.4.0", 
    "es6-promise": "4.1.0", 
    "systemjs": "0.20.12", 
    "zone.js": "0.8.11", 
    "ng2-translate": "5.0.0", 
    "jquery": "3.2.1", 
    "jquery-migrate": "3.0.0", 
    "jszip": "3.1.3",  
    }, 
    "devDependencies": { 
    "concurrently": "3.4.0", 
    "lite-server": "2.3.0", 
    "gulp": "^3.9.1", 
    "typescript": "2.3.2", 
    "typings": "2.1.1" 
    } 
} 

und hier ist TSconfig-aot.josn:

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "es2015", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ "es2015", "dom" ], 
    "noImplicitAny": false, 
    "suppressImplicitAnyIndexErrors": true 
    }, 

    "files": [ 
    "wwwroot/typescript/modules/shared.module.ts", 
    "wwwroot/typescript/modules/test.module.ts", 
    "wwwroot/typescript/modules/app.module.ts", 
    "wwwroot/typescript/main.ts" 
    ], 


    "angularCompilerOptions": { 
    "genDir": "./wwwroot/aot", 
    "skipMetadataEmit" : true 
} 
} 

Antwort

0

Sieht aus wie Sie systemjs verwenden und es nicht weiß, wie App laden .modul.ggfactor. Dies ist wahrscheinlich, weil Sie Systemjs nicht gesagt haben, dass dies eine Javascript-Datei ist.

Ohne Ihre Datei systemjs.config.js zu sehen, denke ich, dass Sie dies lösen können, indem Sie die "defaultJSExtensions" hinzufügen: getreu. z.B.

System.config({ 

    "defaultJSExtensions": true 

}); 
Verwandte Themen