Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build allows non AOT compliant code #56

Open
adamlubek opened this issue Aug 29, 2017 · 2 comments
Open

Build allows non AOT compliant code #56

adamlubek opened this issue Aug 29, 2017 · 2 comments

Comments

@adamlubek
Copy link

this code in module.ts, once imported into Angular CLI based app works fine:

export class LibService {}
export function libProvider() { return LibService; }

@NgModule({
  imports: [
    CommonModule
  ],
  providers: [
    { provide: LibService, useFactory: libProvider() }
  ]
})
export class FeatureModule { }

but this one:

export class LibService {}
export const libProvider = () => LibService;

@NgModule({
  imports: [
    CommonModule
  ],
  providers: [
    { provide: LibService, useFactory: libProvider() }
  ]
})
export class FeatureModule { }

breaks on ng start with:

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function

My understanding is that second snippet, using "export const libProvider = () => LibService;", is not AOT compliant. However, both snippets build fine with angular-quickstart-lib. Questions is, can build of angular-quickstart-lib be setup in a way to break for code that is not AOT compliant?

@franzbecker
Copy link

It seems to me like you didn't execute the integration tests. You should include those in your build pipeline and only publish the library once they pass. Running those on your example yields the same message you encountered.

@adamlubek
Copy link
Author

adamlubek commented Sep 21, 2017

Integration tests in my company are maintained by separate team and are run against application that uses library instead of library level. I'd like to have library build though, which fails for non AOT compliant code (without developers maintaining integration tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants