Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Angular AOT error when having a component within a library #1168

Copy link
Copy link
@stephenlautier

Description

@stephenlautier
Issue body actions

Hi,

Not sure if this an issue, or requires some changes within webpack in order to get it work, perhaps someone else already seen this issue as it should be quite common I would say.
When adding a library such as Angular Material, or even I created a simple component within a library to narrow this down, and building the app as AoT, we get the following error:

    ERROR in ./$$_gendir/~/@odin/ngx.core/dist/xyz.component.ngfactory.ts
    Module parse failed: C:\dev\git\loki\$$_gendir\node_modules\@odin\ngx.core\dist\xyz.component.ngfactory.ts Unexpected token (11:25)
    You may need an appropriate loader to handle this file type.
    | import * as i0 from '@angular/core';
    | import * as i1 from '@odin/ngx.core/dist/xyz.component';
    | const styles_XyzComponent:any[] = ([] as any[]);
    | export const RenderType_XyzComponent:i0.RendererType2 = i0.ɵcrt({encapsulation:2,styles:styles_XyzComponent,
    |     data:{}});
     @ ./$$_gendir/ClientApp/app/areas/home/home.component.ngfactory.ts 9:0-104
     @ ./$$_gendir/ClientApp/app/app.module.browser.ngfactory.ts
     @ ./ClientApp/boot-browser.ts

The following is a simple component which doesn't work

import { Component } from "@angular/core";

@Component({
	selector: "odn-xyz",
	template: `<h1>Xyz5</h1> <button>a button</button>`
})
export class XyzComponent {

}

These are the conditions when it doesn't work.

  • when built with aot (without AoT it works fine)
  • and in a separate library (as a vendor)
  • and library contains a component
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.