I've spent the last 72 hours trying to figure out how to make Ahead-of-Time compilation work for my Angular 2 rc.6
application.
Currently, my application runs smoothly using Just-in-Time compilation.
I've made sure to install all necessary dependencies, run the ngc
compiler, updated my main.ts
to utilize platformBrowser()
, and ran ngc
again.
No errors are showing up in the console. The .ngfactory.ts
files have been generated successfully, as well as the .js
files. Everything seems fine for now. Here is how my structure looks like (it's messy, but I'll tidy it up once I get this working)
https://i.sstatic.net/KqPGV.png
The application is being executed from the dist/
directory. However, the issue arises when I modify map['app']
in systemjs.config.js
from dist
to dist/dev
and then launch the application.
The major red flag appears when I notice that instead of decreasing, the number of HTTP requests and data size has actually increased significantly with AoT compilation. I am now facing 200 additional requests during bootstrap!
Moreover, despite the compilation process showing no errors, the app refuses to start. An unexpected 404 not found
error occurs at the URL: http://localhost/traceur
. What is going on? Why is "traceur" being mentioned? Isn't that related to in-browser transpilation? Where should I begin troubleshooting this issue?