babel-plugin-transform-react-binding icon indicating copy to clipboard operation
babel-plugin-transform-react-binding copied to clipboard

The npm package doesn't contain the compiled version

Open SimonSelg opened this issue 9 years ago • 7 comments
trafficstars

Hey,

the current version of the npm package (0.1.2) does not contain the compiled version (lib/index.js), meaning any require of this package will fail.

Could you publish a new version w/ the compiled source please?

Thanks!

SimonSelg avatar Jun 20 '16 12:06 SimonSelg

I get ReferenceError: Unknown plugin "transform-react-binding" specified in "base" when attempting to load my app with this plugin, is that the same issue as this by any chance?

mmiller42 avatar Oct 10 '16 00:10 mmiller42

I was too lazy to fork it, so I made a very shameful hack. If anyone else chances across this, beware that it's pretty terrible, but it's the quickest fix.

Add this to the scripts section of your package.json:

"postinstall": "cd node_modules/babel-plugin-transform-react-binding && npm install && npm run build"

Basically, since the compiled version wasn't added to this plugin's package, this script runs the build on this particular plugin manually after you install.

If you've already installed, just manually run it: npm run postinstall.

Hopefully this package can be fixed soon; otherwise, maybe someone wants to fork it and publish their own with the fix? I might later anyway, since I can't keep this horrible postinstall hook forever.

mmiller42 avatar Oct 10 '16 01:10 mmiller42

@mmiller42 : You probably don't want to use this plugin. It has many bugs in its transforms that will break your code at some point (it doesn't walk the AST correctly and changes things it isn't supposed to change).

I spend many hours trying to track down bugs in my code that were due this plugin, spare yourself that time (note that the author says [this is] '😱 Experimental! 😱').

SimonSelg avatar Oct 11 '16 22:10 SimonSelg

Good to know. This would be an extremely useful Babel extension, do you know if anyone has made something similar that does this binding?

mmiller42 avatar Oct 12 '16 15:10 mmiller42

Yeah, i did, kinda at least. After I tried this one and realized it's really buggy i started to write my own plugin to accomplish the same task. Never got to finish it tho, but I'll think about picking the development up again or just pushlishing it in it's current state. Ran out of time :-/

SimonSelg avatar Oct 12 '16 16:10 SimonSelg

Awesome! I'm surprised to see so little traction with this plugin, seems like a major nice-to-have in the React world.

mmiller42 avatar Oct 12 '16 22:10 mmiller42

@SimonSelg Any progress with your plugin?

alecmev avatar Jan 23 '17 12:01 alecmev