question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Components does not work in a fresh Nuxt 3 project

See original GitHub issue

Bug 🐞

What is the current behavior?

image

Make a sandbox with the current behavior

  1. Create new nuxt 3 project.
  2. Follow the tutorial here https://www.algolia.com/doc/guides/building-search-ui/going-further/server-side-rendering/vue/#with-nuxt (but use vue-instantsearch/vue3/es instead)
  3. See the error

Template: https://codesandbox.io/s/github/algolia/create-instantsearch-app/tree/templates/vue-instantsearch

What is the expected behavior?

It should render the components correctly

Does this happen only in specific situations?

Always

What is the proposed solution?

Review this hogan library.

What is the version you are using?

“algoliasearch”: “^4.11.0”, “vue-instantsearch”: “^4.3.1”

Always try the latest one before opening an issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
CapitaineToinoncommented, Feb 8, 2022

I managed to get vue-instantsearch + MeiliSearch to work on a Nuxt 3 project by installing

"@meilisearch/instant-meilisearch": "^0.6.0",
"instantsearch.css": "^7.4.5",
"vue-instantsearch": "^4.3.2"

Installing InstantSearch as a client side only plugin using plugins/instantSearch.client.ts (notice the .client in the filename. I followed the Vue Plugin section of nuxt’s documentation) :

import { defineNuxtPlugin } from "#app";
import InstantSearch from "vue-instantsearch/vue3/es";

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(InstantSearch);
});

When trying with a regular plugin, I was having the m.default is not a function error but that’s not the case with client side only. And finally created a simple modal search exemple like this

<script setup lang="ts">
import "instantsearch.css/themes/satellite-min.css";
import { instantMeiliSearch } from "@meilisearch/instant-meilisearch";

const searchClient = instantMeiliSearch("http://localhost:7700", "");
</script>

<template>
  <div class="modal modal-open">
    <div ref="modal" class="modal-box">
      <ais-instant-search :search-client="searchClient" index-name="game">
        <ais-search-box />
        <ais-hits>
          <template v-slot:item="{ item }">
            <h2>{{ item.name }}</h2>
          </template>
        </ais-hits>
      </ais-instant-search>
    </div>
  </div>
</template>

And this gives me a simple search modal. I did not have to add vue-instantsearch to the transpile option in my nuxt config.

image image

I haved not tried with algolia as the searchClient though.

2reactions
Haroenvcommented, Feb 10, 2022

The release including those fixes will be done in a couple minutes @Baroshem 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt 3 trouble after build project - Stack Overflow
The Problem. After build project does not work html5 video on MacOS < 15 version and iOS < 15 version. Path is ok,...
Read more >
Nuxt 3 first steps. - ITNEXT
OK, first things first. What's nuxi ? It's the new Nuxt CLI (Command Line Interface) that will help you install and manage all...
Read more >
Installation - Nuxt
Here, you will find information on setting up and running a Nuxt project in 4 steps.
Read more >
Getting Started - BootstrapVue
Note that when importing individual components, any component aliases will not be available. Note: Optimal tree shaking only works when your Nuxt.js app...
Read more >
Vue.js | WebStorm Documentation - JetBrains
Open the empty project where you will use Vue.js. ... WebStorm passes them to the new component with properties and copies the related ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found