question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could/would/will code using COMPILER_PROVIDERS be supported by AOT?

See original GitHub issue

When I run a command

>"node_modules/.bin/ngc" -p ./

I get the error:

Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 65:17 in the original .ts file), resolving symbol COMPILER_PROVIDERS in …/node_modules/@angular/compiler/src/compiler.d.ts,

That all is related to this piece of code

@NgModule({
    ...
    providers: [
        COMPILER_PROVIDERS
    ],  
})
export class AppModule {}

Once COMPILER_PROVIDERS are not declared

    providers: [
        // COMPILER_PROVIDERS

then AOT works as expected… just … as also expected, the app is not working (simply, COMPILER_PROVIDERS are needed for it)

I did see this “encouraging disclaimer”

/**
 * @module
 * @description
 * Entry point for all APIs of the compiler package.
 *
 * <div class="callout is-critical">
 *   <header>Unstable APIs</header>
 *   <p>
 *     All compiler apis are currently considered experimental and private!
 *   </p>
 *   <p>
 *     We expect the APIs in this package to keep on changing. Do not rely on them.
 *   </p>
 * </div>

So - it is experimental, private, “I cannot rely on it” … but I need it.

Please, am I doing something wrong? or is intended … COMPILER_PROVIDERS will never be supported by AOT?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:44
  • Comments:35 (16 by maintainers)

github_iconTop GitHub Comments

40reactions
DzmitryShylovichcommented, Oct 27, 2016

Don’t use runtime compiler and aot.

39reactions
seanlandsmancommented, Sep 22, 2016

Unless you’re developing a library which creates components dynamically - as we are.

Our users want to be able to use AoT compiling on their projects, but we’re unable to compile ours first (and generate the necessary metadata files) due to the above issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Initial AOT support in Spring Framework 6.0.0-M3
In a nutshell, this infrastructure lets us compile code (with an abstraction allowing us to provide source code in memory) and run assertions ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found