leafo/sticky-kit

Cannot read property 'jQuery' of undefined

Opened this issue ยท 15 comments

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

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

$ = window.jQuery;

Tha's what I did too.

leafo commented

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

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

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

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 ?

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

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

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.

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

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

@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.

Awesome, thank you very much!

How do you guys manage to build it?
I get another error: #248

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