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.

The Log decorator/annotation does not support AoT compilation

See original GitHub issue

At https://github.com/k1r0s/kaop-ts/blob/master/docs/examples.md#log-decorator (and related linked documentation), you give an example that does not pass Angular5’s AoT compilation. To get this to work, it should be:

import { afterMethod, IMetadata } from 'kaop-ts';

export function Log(): Function {
  return afterMethod((meta: IMetadata) => {
    const methodName = `${meta.target.constructor.name}::${meta.key}`;
    console.info(`log-decorator: ${methodName} invoked!`);
    console.info(`log-decorator: ${methodName} arguments -> `, meta.args);
    console.info(`log-decorator: ${methodName} result -> `, meta.result);
  });
}

Then, the decorator should be used as @Log() instead of @Log.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
voznikcommented, Mar 11, 2018

@k1r0s I think it is a bug - in v3.1.3. when I was trying update to v3.1.3 my build was broken similar to @russcarver currently I’m in production with angular@5.2.6 and AOT and kaop-ts@3.1.2.

0reactions
k1r0scommented, Apr 21, 2018

closing this due to inactivity

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error AOT building a custom component decorator
Custom decorators like these do not work in AOT, because the compiler is looking for classes which have the @Component decorator.
Read more >
[Angular] Custom Decorators stripped out of AOT
The decorators are being used during AOT compilation. they should modify your class ... Whatever is NOT listed is most likely not supported....
Read more >
Ahead-of-time (AOT) compilation
The AOT compiler does not support function expressions and arrow functions, also called lambda functions. Consider the following component decorator:.
Read more >
Table of Contents - Micronaut Documentation
Micronaut AOT is now fully supported for Maven users. ... If an annotation is not explicitly annotated with @Inherited it will not be...
Read more >
Ahead of Time Compilation
No additional compilation time is done when running your application. ... SYCL supports AOT compilation for the following targets: Intel® CPUs, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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