WannaBDeveloper
WannaBDeveloper

Reputation: 146

Angular 6, ngc, AOT, Angular Router, router.ngfactory and SystemJS

I have a simple angular 6 application I am trying to get compiled with AOT. I am NOT using the Angular CLI. I have a custom generator that scaffolds my project start and scaffolds my components, services, etc.

Everything works as expected pre-AOT. When i run ngc to compile my angular application everything compiles without errors. However when I check the compiled ngfactory javascript files, I see a reference for @angular/router/router.ngfactory from node_modules directory. I can't seem to locate this file anywhere.

My configuration is as follows:

I created a sample repo to replicate the issue.

The repo is located at SlyGenerator.DemoWithAOT

To start the application normally with JIT run the following command "npm run start-dev"

To reproduce the error

At this point I get the following error:

SyntaxError: Unexpected token <

I can switch the system.config.js file back to the original and everything works fine again.

Upvotes: 0

Views: 330

Answers (1)

WannaBDeveloper
WannaBDeveloper

Reputation: 146

After troubleshooting for a view days. I found out the issue was related to a missing library / feature module.

IMO the > error generally has to do with missing files.

Upvotes: 0

Related Questions