The Log decorator/annotation does not support AoT compilation
See original GitHub issueAt 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:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@k1r0s I think it is a bug - in
v3.1.3
. when I was trying update tov3.1.3
my build was broken similar to @russcarver currently I’m in production withangular@5.2.6
and AOT andkaop-ts@3.1.2
.closing this due to inactivity