Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Npm install: isArray error when using Browserify #872

Closed
joshhornby opened this issue Jun 20, 2014 · 6 comments
Closed

Npm install: isArray error when using Browserify #872

joshhornby opened this issue Jun 20, 2014 · 6 comments

Comments

@joshhornby
Copy link

I am using Browserify and trying to require the npm package of typeahead.js

var $ = require('jquery');
var typehead = require('typeahead.js');

When I run this in the browser I get the following error:

Uncaught TypeError: Cannot read property 'isArray' of undefined

Any ideas? Guessing it is an issue with jQuery not being loaded correctly?

@jharding
Copy link
Contributor

jharding commented Jul 9, 2014

I'm not overly familiar with browserify so I'm not sure what's going on. If you have't figured this out already, your best bet is to ask on Stack Overflow.

BTW, if you have figured it out, it'd be great if you could share what the issue was for future reference.

@jharding jharding closed this as completed Jul 9, 2014
@nicl
Copy link

nicl commented Jul 22, 2014

@joshhornby I got this too. Typeahead is trying to inject jquery from window.jQuery. So you could do one of a few things:

  • copy the bundled typehead script into your own file and then modify to pass jquery correctly (i.e. by requiring it at the top of the script and then passing in that name)

  • or modifying the window object before including it. e.g.

    var $ = require('jquery');
    window.jQuery = $; // hack to make typeahead work
    require('typeahead.js');

This is definitely a bug for the npm package though.

@davis
Copy link

davis commented Dec 9, 2014

there just need to be an AMD version of Bloodhound and Typeahead
you can also use browserify-shim to get this stuff to work

@clayzermk1
Copy link

https://github.com/umdjs/umd anyone?

@davis
Copy link

davis commented Jul 2, 2015

so how do we use this with browserify/webpack/jspm or is that still not a thing?

@rsshilli
Copy link

It's still not a thing, really. This package is no longer maintained. But luckily somebody forked it and is maintaining it here:

https://github.com/corejavascript/typeahead.js

And that one can be imported (at least using webpack) and seems to work great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants