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

<Select> is not a valid SSR component in Sapper #87

Closed
hdeyana opened this issue Oct 19, 2019 · 12 comments
Closed

<Select> is not a valid SSR component in Sapper #87

hdeyana opened this issue Oct 19, 2019 · 12 comments

Comments

@hdeyana
Copy link

hdeyana commented Oct 19, 2019

i'm using sapper, if you install it with npm i svelte-select, and use it.
you will get this error

<Select> is not a valid SSR component

to resolve it, just install it in dev dependency

npm i --save-dev svelte-select

relate to this
sveltejs/sapper#774

if this is good way to solve, maybe you can add in readme ?

@rob-balfre
Copy link
Owner

rob-balfre commented Oct 19, 2019 via email

@rob-balfre
Copy link
Owner

@hdeyana strange, I just tried adding svelte-select to a sapper application and didn't see the error. What version of Sapper are you using?

@hdeyana
Copy link
Author

hdeyana commented Oct 21, 2019

@rob-balfre try in slow 3G connection you'll see the error, then error disapear.

@rob-balfre
Copy link
Owner

@hdeyana are you using webpack or rollup? If webpack make sure you do this.. https://github.com/rob-balfre/svelte-select#configuring-webpack

@hdeyana
Copy link
Author

hdeyana commented Oct 22, 2019

@rob-balfre
Copy link
Owner

How are you importing svelte-select?

@rob-balfre
Copy link
Owner

@rob-balfre
Copy link
Owner

OH WAIT! I SEE IT NOW! I will debug :D

rob-balfre added a commit that referenced this issue Oct 24, 2019
@rob-balfre
Copy link
Owner

Updated README, thanks for spotting that @hdeyana 👍

@softwarerero
Copy link

It is also possible to render the select only on the client:

{#if (process.browser) }
	<Select items={items} ></Select>
{/if}

@shailesh345
Copy link

Thank you @softwarerero

{#if (process.browser) }

{/if}

@Absleepy
Copy link

import { browser } from '$app/environment';

  {#if browser}
  <YourComponent />

  {/if}

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

No branches or pull requests

5 participants