Skip to content

"ng build -prod" - component's template not showing #1792

@NgxDev

Description

@NgxDev

I don't know how to best describe this in the title, maybe if someone has a suggestion.
The content (template) of the components I have in the declarations array in my app.module.ts, that are used within other components, don't show up at all when building with the "-prod" flag.

Steps to reproduce:

  1. ng new my-app --directory ng.app (I don't know why, but this sets "app" as prefix if you check angular-cli.json, I would have expected the prefix to be "my-app")
  2. cd ng.app
  3. mkdir src/app/layout
  4. ng generate component layout/header
  5. go into "app.module.ts" and correct the path from where the newly HeaderComponent is imported (this is a bug Angular-cli@1.0.0-beta.11-webpack.2 BUG - relative components generation #1714)
  6. go into app.component.html and add <app-header></app-header>.
  7. run ng serve and access http://localhost:4200. You see "app works!" and "header works!"
  8. run ng serve -prod and access http://localhost:4200. Now you only see "app works!". The HeaderComponent template is not rendered anymore. If you inspect the dom, you can see the <app-header></app-header> tag there. But it's empty.

No errors on build and no errors in the browser console.

angular-cli: 1.0.0-beta.11-webpack.2
node: 6.4.0
os: win32 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfultype: bug/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions