Closed jonscottclark closed 6 years ago
Interesting. Will do.
Awesome! If you publish your changes to a different branch I can help you test.
As far as I know, all you'll need to do is replace line 30 (https://github.com/umdjs/umd/blob/master/templates/jqueryPlugin.js#L30) with the plugin code.
But you won't need to use scopedWindow because the wrapper will handle the scope of of the $
variable (whether it's on the window
object or part of the CommonJS environment) And, bonus! AMD support. lol
Fixed in baron@3.0.0
Working without jQuery now
Hi @Diokuz,
I was trying to use baron in my Browserify project and I'm getting this error: $(...).baron() is not a function
I see that you've exported the
baron
function so it appears you've given some thought to exporting baron to a CommonJS environment.I think the problem is that the $ variable is set here: https://github.com/Diokuz/baron/blob/master/baron.js#L5, and it's assumed that jQuery will be in the
window
object, or in the case of a node environment it would beroot
. But the copy of jQuery that I'm using is bundled in the same browserify project. In the past I have made plugins work by using a universal module definition wrapper: https://github.com/umdjs/umd/blob/master/templates/jqueryPlugin.js, which passes $ to your plugin as arequire
d copy of jQuery.The architecture of this plugin is rather large and the few fixes I tried to implement didn't work, so I'm just submitting the issue to see if you have any insights.