Visual Studio 2015 커뮤니티 환경에서 Angular2 (최신 버전) 프로젝트에서 작업하고 있습니다. AoT에 대한 설정을 지정했고 /aot
폴더로 출력하고 있습니다. 내가 프로젝트를 실행하면컴파일 된 스크립트를로드 할 때 Angular2 AoT 404
, 내 브라우저에서 다음과 같은 오류가 발생합니다 :
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
나는 응용 프로그램의 폴더 구조 내에서 파일을 찾을 수 있습니다. 거기에 있고 비어 있지 않습니다.
내 main.ts 파일은 다음과 같다 : 나는 다른 필요한 코드를 제공 할 수 있습니다 필요한 경우
import {platformBrowser} from '@angular/platform-browser';
import { AppModuleNgFactory } from '../aot/app/app.module.ngfactory';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
. main.ts
의 경로 import { AppModuleNgFactory } from 'app.module.ngfactory';
해야합니다 귀하의 오류 로그 오류가 발생 main.ts
및 app.module.ngfactory
파일 app
폴더에 당으로
사실 .. ../aot/app/app.module.ngfactory' 모듈이 인식됩니다. 그러나 어떤 이유로 든 가져올 수 없습니다. 내가 한 것은 루트 폴더로 컴파일하고 다음과 같이 액세스했습니다 :'./app/app.module.ngfactory'. 나는 컴파일러가 폴더 트리에 올라가는 것을 좋아하지 않는다고 생각한다. 힌트를 주셔서 감사합니다. – Nodios