andreypopp / autobind-decorator

Decorator to automatically bind methods to class instances
MIT License
1.45k stars 66 forks source link

Does not work with Babel 6.0 #13

Closed Grmiade closed 7 years ago

Grmiade commented 8 years ago

I have not managed to run autobind decorator with babelify 7.2.0 and babel 6.0.15, the lasts versions. I don't have errors but i think that autobind is not made, I have to make it for the hand.

My configuration in gulp:

...
transform: [babelify.configure({
      presets: ["react", "stage-0", "es2015"],
    })],
...

My bad ?

ebello commented 8 years ago

It looks like this is a known issue with Babel 6.0. Decorator support has been removed as the spec is changing rapidly.

DanielMSchmidt commented 8 years ago

Hi there,

you may use the transform-decorators-legacy plugin, this works fine with Babel 6.0.

emirotin commented 8 years ago

Doesn't work with react-hot-loader though.

It only defines getter while hot-loader tries to patch the property.

 function patchProperty(proto, key) {
    proto[key] = storedPrototype[key];
andreypopp commented 8 years ago

@emirotin try react-transform-hmr or react-hot-loader v2 (I think alpha is published on npm). v1 doesn't support getters.

emirotin commented 8 years ago

Thanks for the tip! I'm new to React ecosystem which is huge :)

ghost commented 8 years ago

No issues using this with Babel 6. Thank you so much for creating this stop gap library! This issue can be closed, or a new one opened if HMR continues to be an issue for some.

anthonator commented 8 years ago

@jhabdas do you mind sharing how you got it to work?

I guess I could just follow the link you provided.

stevemao commented 7 years ago

98968ee should have fixed this. Please try the latest master branch :)

ghost commented 7 years ago

Cheers to you good friend. Cheers to you.