简体   繁体   中英

Angular 2 Aot : Zoneware (SystemJS) XHR error

I am working on Angular Ahead of Time Compilation(AoT), where I have generated build.js file and while loading, stuck with below issue

(SystemJS) XHR error (404 Not Found) loading http://localhost:58082/aot/app/app.module.ngfactory

Included below files in index.html

<script src="shim.min.js"></script>
    <script src="zone.min.js"></script>

Three possibilities of getting this issue

1) we include this script in index.html page

 <script>window.module = 'aot';</script>

So We have to include in every component the module field along with selector and template

@Component({
    moduleId: module.id,
    selector: 'myapp',
    templateUrl: '../../master/html/test.html'
})

2)This script should be at the bottom of html page

<script src="dist/build.js"></script>

3)Last but important , No lazy loading for Ahead of time compilation

This resolved my issues and app with AOT is running but inside stuck with few issues like Zoneware error of stack undefined.Resolving them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM