2

I am trying to build a production version of my angular web application. The command that I am using is:

ng build --prod

It is my understanding that this will build a version of the application using aot. However when I try the above command I am met with the following error message.

ERROR in D:/git/tpa/tpa-tnet/TNET.Invoices.Api/TNET.Invoices.Web/src/$$_gendir/app/content/headers/header-list/edit-invoice-details/edit-invoice-details.component.ngfactory.ts (21,22): Cannot find module './edit-detail/edit-detail.
component.ngfactory'.
ERROR in D:/git/tpa/tpa-tnet/TNET.Invoices.Api/TNET.Invoices.Web/src/$$_gendir/app/content/headers/header-list/edit-invoice-details/edit-invoice-details.component.ngfactory.ts (21,22): Cannot find module './edit-detail/edit-detail.
component.ngfactory'.
ERROR in ./src/$$_gendir/app/content/headers/header-list/edit-invoice-details/edit-invoice-details.component.ngfactory.ts
Module not found: Error: Can't resolve './edit-detail/edit-detail.component.ngfactory' in 'D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details'
resolve './edit-detail/edit-detail.component.ngfactory' in 'D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details'
  using description file: D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\package.json (relative path: ./src/$$_gendir/app/content/headers/header-list/edit-invoice-details)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\package.json (relative path: ./src/$$_gendir/app/content/headers/header-list/edit-invoice-details)
    using description file: D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\package.json (relative path: ./src/$$_gendir/app/content/headers/header-list/edit-invoice-details/edit-detail/edit-detail.component.ngfactory)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory.js doesn't exist
      as directory
        D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory doesn't exist
[D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory]
[D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory.ts]
[D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory.js]
[D:\git\tpa\tpa-tnet\TNET.Invoices.Api\TNET.Invoices.Web\src\$$_gendir\app\content\headers\header-list\edit-invoice-details\edit-detail\edit-detail.component.ngfactory]
 @ ./src/$$_gendir/app/content/headers/header-list/edit-invoice-details/edit-invoice-details.component.ngfactory.ts 19:0-69
 @ ./src/$$_gendir/app/content/headers/header-list/header-list.component.ngfactory.ts
 @ ./src/$$_gendir/app/app.module.ngfactory.ts
 @ ./src/main.ts
 @ multi ./src/main.ts

I can't seem to find out what I am doing wrong. Every thing I saw online suggest that this should just work. Any advice will be much appreciated.

Dblock247
  • 6,167
  • 10
  • 44
  • 66
  • check your html components, if has invalid variables, because when you run ng build --prod the html files are turned in javascript files and if doesn't find the variable throws this error. – Deyvison Souto Aug 23 '17 at 20:14
  • @DeyvisonSouto I am not sure what I am looking for. Please elaborate. – Dblock247 Aug 23 '17 at 20:15
  • I've seen a similar problem recently and it was an issue with the version of TypeScript that is installed. If you type `tsd -v` what version of TypeScript do you have? – DeborahK Aug 23 '17 at 20:25
  • https://github.com/angular/angular-cli/issues/5596 – Deyvison Souto Aug 23 '17 at 20:26
  • @DeborahK my typescript version is 2.4.2. Aslo I created a brand new angular-cli project and I can run ng build --prod and it work no problem. – Dblock247 Aug 23 '17 at 20:44
  • can you show the edit-invoice-details component and template ? – Rahul Singh Aug 24 '17 at 05:53
  • 1
    @DeborahK I actually figured it out this morning. One of my imports in app.module.ts had an uppercase letter in it. ng serve seemed to deal with it just fine but ng build --prod threw the above error. So in the end ng build --prod is case sensitive when it comes to imports. – Dblock247 Aug 24 '17 at 16:11
  • Good to know. Thanks for posting. There is work underway to use the same type of compile for dev and production so these types of things surface sooner. – DeborahK Aug 24 '17 at 17:40
  • You should add an answer and accept it so it's more visible for other people who may end up on this post in the future – Andrei Matracaru Aug 25 '17 at 11:18

0 Answers0