Ich arbeite an einem Angular2 (neueste Version) Projekt in Visual Studio 2015 Community-Umgebung. Ich habe die Einstellungen für das AoT eingestellt und ich gebe zu /aot
Ordner aus.Angular2 AoT 404 beim Laden kompilierter Skripte
Als ich das Projekt ausführen, bekomme ich die folgenden Fehler in meinem Browser:
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:15609/aot/app/app.module.ngfactory
localhost/:28 Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:15609/aot/app/app.module.ngfactory
Error: XHR error (404 Not Found) loading http://localhost:15609/aot/app/app.module.ngfactory
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:15609/node_modules/zone.js/dist/zone.js:647:29)
at ZoneDelegate.invokeTask (http://localhost:15609/node_modules/zone.js/dist/zone.js:236:37)
at Zone.runTask (http://localhost:15609/node_modules/zone.js/dist/zone.js:136:47)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:15609/node_modules/zone.js/dist/zone.js:304:33)
Error loading http://localhost:15609/aot/app/app.module.ngfactory as "../aot/app/app.module.ngfactory" from http://localhost:15609/app/main.js
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:15609/node_modules/zone.js/dist/zone.js:647:29)
at ZoneDelegate.invokeTask (http://localhost:15609/node_modules/zone.js/dist/zone.js:236:37)
at Zone.runTask (http://localhost:15609/node_modules/zone.js/dist/zone.js:136:47)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:15609/node_modules/zone.js/dist/zone.js:304:33)
Error loading http://localhost:15609/aot/app/app.module.ngfactory as "../aot/app/app.module.ngfactory" from http://localhost:15609/app/main.js(anonymous function) @ localhost/:28
ich die Datei innerhalb einer Ordnerstruktur der Anwendung finden kann. Es ist da und nicht leer.
Meine main.ts Datei sieht wie folgt aus:
import {platformBrowser} from '@angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
Bei Bedarf ich andere benötigte Code zur Verfügung stellen kann.
Tatsächlich wird das Modul '../ aot/app/app.module.ngfactory 'erkannt. Aber aus irgendeinem Grund wird nicht so importiert, wie es sollte. Was ich getan habe, war nur in einen Stammordner zu kompilieren und es wie folgt aufzurufen: './App/app.module.ngfactory'. Ich schätze, der Compiler mag es nicht, wenn er in den Ordnerbaum geht. Danke für den Hinweis tho! – Nodios