0

I have the following import statement,

import { AppModuleNgFactory } from './app.module.ngfactory';

and it spits out an error - Cannot resolve a symbol AppModuleNgFactory.

I am using https://github.com/mgechev/angular-seed for my angular 2 application.

Any help is appreciated.

Abhi
  • 4,553
  • 4
  • 16
  • 22
  • what npm command that gives you this error? – Ben Dadsetan Feb 27 '17 at 20:06
  • well my tests are failing using 'npm test' command and this import statement is a part of my code from the seed project. So I think this is related to my issue of failing jasmine tests giving the following error - Failed: Invalid providers for "" - only instances of Provider and Type are allowed, got: [?undefined?]. – Abhi Feb 27 '17 at 20:14
  • I am 90% sure that the missing file is generated by AOT building. Please try to use the solution presented in my answer. – Ben Dadsetan Feb 27 '17 at 20:24
  • Is AppModuleNgFactory from the Angular2 Seed Project or is this your own personal module? Also, is it an Angular module or a service? – Jim Feb 27 '17 at 20:41
  • I checked. It is not in the seed itself. I believe it is generated as part of the aot process. It is however used by some of the seed files. – Ben Dadsetan Feb 27 '17 at 20:59
  • @BenDadsetan Do you mean, the file won't be generated unless I pass the build using the command you provided? because my build is failing for now. – Abhi Feb 28 '17 at 00:44

1 Answers1

0

It would seem you are maybe using AOT generated compiled files before having run the AOT build.

Try running

npm run build.prod.aot
Ben Dadsetan
  • 1,565
  • 11
  • 19