aymeric-giraudet / svelte-algolia-instantsearch

A Svelte component library for Algolia InstantSearch.js
https://svelte-algolia-instantsearch.vercel.app/
MIT License
45 stars 12 forks source link

Uncaught ReferenceError: stores is not defined #11

Closed DrupalPhil closed 11 months ago

DrupalPhil commented 1 year ago

Using a barebones REPL and your "Basic usage" example to get started, I get this error: Uncaught ReferenceError: stores is not defined

Is this project only available for Sveltekit?

multiplehats commented 1 year ago

@DrupalPhil it’s using getServerState"; import { page } from "$app/stores"; amongst other things from SvelteKit. So yeah, only SK support.

aymeric-giraudet commented 1 year ago

Hey @DrupalPhil !

At first I implemented it without this import { page } from "$app/stores" line which would have made it work with Svelte alone, at the cost of needing more userland code for SvelteKit users.

I'm still not too sure what's the best approach, I personally think it's better to use SvelteKit by default as it does everything Svelte does with more optimizations, especially on an app where you'd use Algolia you'll most likely want features like SSR.

Maybe I should talk to more people in the Svelte community to find out if bare Svelte is still relevant, or if they think SvelteKit is the way to go for all apps.

aymeric-giraudet commented 11 months ago

Seems like SvelteKit is now the default, as running npm create svelte only initializes SvelteKit projects. I'll stick to my choice then, as I suspect most users of this library are using SvelteKit, so I added it as peer dependency and will update the README as well !