leafo / sticky-kit

A jQuery plugin for creating smart sticky elements
http://leafo.net/sticky-kit
2.91k stars 521 forks source link

Cannot read property 'jQuery' of undefined #200

Open zomars opened 8 years ago

zomars commented 8 years ago

I'm getting this error when the file is being concatenated in a minified file and it's pointing to this line.

dmitrylebedev commented 8 years ago

Hi, I delete temporary this from string this.jQuery and left this:

$ = window.jQuery;
zomars commented 8 years ago

Tha's what I did too.

leafo commented 8 years ago

Is this something about your setup that would have jQuery not be available in the name jQuery?

zomars commented 8 years ago

jQuery is available, but not under the "this" namespace. If it helps to know, I'm using the jquery dist file from bower. And the only thing I'm doing is concatenating those files in the correct order.

leafo commented 8 years ago

this should default to window, is the library getting wrapped in something that's changing that?

tim-field commented 8 years ago

Yeah can confirm that this.jQuery is causing this module to be unusable with a modern build system ( browserify or webpack ) Can it just be removed ?

zomars commented 8 years ago

It's not getting wrapped and it's the first file being called.

rebusweb commented 7 years ago

@leafo could you please update npm package for v1.3 ?

maurobringolf commented 7 years ago

Am I missing something or is this still a thing? I installed the lib via npm (1.1.3 on npm), but still have the this.jQuery in it. I see that the current version here on GitHub has it fixed, but still get the old code and error from npm.

rebusweb commented 7 years ago

@maurobringolf Don't use npm package, use npm and github link github:leafo/sticky-kit

maurobringolf commented 7 years ago

@rebusweb Will this install master branch or latest release on github? Thanks for the hint! But this is a workaround, right?

rebusweb commented 7 years ago

@maurobringolf it's master, but you can also use github:username/package#commit convention. yes, it's kind of a workaround, but using github links in npm is a standard functionality.

maurobringolf commented 7 years ago

Awesome, thank you very much!

OnkelTem commented 7 years ago

How do you guys manage to build it? I get another error: https://github.com/leafo/sticky-kit/issues/248

@rebusweb How do you include it? Do you use Browserify?

rebusweb commented 7 years ago

@OnkelTem nope.