Home > Enterprise >  Vue.js instant search - console error - unable to invoke .use on InstantSearch
Vue.js instant search - console error - unable to invoke .use on InstantSearch

Time:12-21

I’ve followed the guide for installing vue instantsearch (4.3) in my Vue.js (3.0) application.

In my main.js file, I have the following -

import InstantSearch from 'vue-instantsearch/vue3/es'

Vue.use(InstantSearch);

Here’s the exact console error -

Uncaught TypeError: Cannot read properties of undefined (reading 'use')

This is the code that’s provided in the guide so I’m unsure why I’m receiving this error.

CodePudding user response:

Also, vue 3 now uses create app so below would work best

import { createApp } from 'vue'
import Root from './App.vue'
import InstantSearch from 'vue-instantsearch/vue3/es'

const app = createApp(Root)
    .use(InstantSearch)
    .mount('#app')
  • Related