algolia / vue-instantsearch

👀 Algolia components for building search UIs with Vue.js

Home Page:https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/vue

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot initialize InstantSearch on Vue 3

DarkGhostHunter opened this issue · comments

commented

Bug 🐞

What is the current behavior?

Following these instructions, the InstantSearch cannot be initialized due to an error on the library.

instantsearch.umd.js:5 Uncaught TypeError: window.Vue.use is not a function
    at instantsearch.umd.js:5
    at vue-instantsearch.js:1
    at vue-instantsearch.js:1

This is the line.

Make a sandbox with the current behavior

https://codesandbox.io/s/nifty-taussig-wh5m4?file=/index.html

(No console error is displayed because the error happens in the library).

What is the expected behavior?

To actually work.

Does this happen only in specific situations?

Only when using Vue 3 and the instructions "Directly in your page".

What is the proposed solution?

For what I can understand, checking the Vue version before adding as a plugin shouldn't break anything, as adding a plugin differs from Vue 2 to Vue 3. Specifically, the developer needs to explicitly add the plugin to the app instance.

If Vue 2 is not detected (Vue.version should work), use() shouldn't be called.

What is the version you are using?

  • Vue InstantSearch 4.1.0
  • Vue 3.2.0
commented

Will be released in 4.1.1