-
Notifications
You must be signed in to change notification settings - Fork 14
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
metadata is undefined (Babel) #9
Comments
Hi there! Thanks for oppening the issue. I was not able to reproduce with a custom test (check below)
I Think the problem is that you're overriding method constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this); // avoid
} You should do this instead, in order to keep method behavior: <div className="App-header" onClick={this.handleClick.bind(this)}> |
@k1r0s Thanks for reply MyAdvices.js
After transform it with After transform, partial code
|
I have to check this in deep. This lib isn't coded against babel since they dropped support for decorators some time ago .. Please share your package.json in order to test it. Thanks! |
At first I added package.json
.babelrc
|
Hi again @liangzr , Main problem with babel is about param decorators. In order to retrieve metadata you need @adviceMetadata decorator which isn't working on babel as I have tested. Typescript implemented this some time ago. While babel firstly drop support because this feature wasn't fully included in decorators proposal.. (param decorators wasn't included initially). More info: babel/babel#1301 And now are working to implement that feature: babel/proposals#13 There are so call plugins to enable param decorators in babel but none of them worked for me in babel. I'll keep an eye on this, but I recommend to use this library with typescript. There is a JS vanilla version https://github.com/k1r0s/kaop which provides AOP tools in browsers world (ES5) That's all :( Hope @babel keep working on this |
Thanks a lot @k1r0s , It is difficult to replace the whole project into typescript, but I wirte advices files use typescript (that I learned just last weekend :P) according to your suggestion, use babel for other I also will keep an eye on this, thanks for you libarary! |
Nice. Hope Babel keep pushing decorators feature Any doubts give me a touch :) I think we can close this issue. Thanks a lot |
Hey @liangzr, checkout last release :) |
@k1r0s gread job! Although I prefer to use typescript now, but there are a lot of people use original javasciprt,which is very useful for them. |
Nice if you take that decision! Typescript is wonderful |
I create a simple advice just like Get Started, but advices can't find metadata.
App.js
MyAdvices.js
The text was updated successfully, but these errors were encountered: