svelteuidev / svelteui

SvelteUI Monorepo
https://svelteui.dev
MIT License
1.3k stars 62 forks source link

SSR not working with svelteKit 1.0 #285

Closed Rick-Young closed 1 year ago

Rick-Young commented 1 year ago

What package has an issue

@svelteuidev/core

A clear and concise description of what the bug is

I'm starting a new project with svelteKit 1.0 and svelteUI and I'm trying to get ssr working correctly. In my +layout.svelte I import { SvelteUIProvider } from '@svelteuidev/core'; then I'm setting the ssr prop. see below but it does not render any styles on the page for the sevlteui components

<SvelteUIProvider ssr withNormalizeCSS withGlobalStyles themeObserver={isDark ? 'dark' : 'light'}>

<Header toggleTheme={toggleTheme} />

<slot></slot>

Also I created a hooks.server.ts file at the same level as my +layout.server.ts file will with the following code to see if that would help but it could not find the prepareStylesSSR in the '@svelteuidev/core

import { prepareStylesSSR } from '@svelteuidev/core';

export const handle = prepareStylesSSR;

In which browser(s) did the problem occur?

No response

Steps To Reproduce

See above

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

No

Relevant Assets

No response

BeeMargarida commented 1 year ago

The latest version 0.8.0 removed the ssr prop and introduced the hook solution. Could you please tell me if you are using that version? Also, the hooks.server.ts must be at src/ level, like it says in the docs.

Rick-Young commented 1 year ago

Ana,

I got it working I had to update to version 0.8.0 and it works now. Thanks for getting back to me so quick

Thanks!

Rick

From: Ana Margarida Silva @.*** Sent: Sunday, January 22, 2023 9:09 AM To: svelteuidev/svelteui Cc: Rick-Young; Author Subject: Re: [svelteuidev/svelteui] SSR not working with svelteKit 1.0 (Issue #285)

The latest version 0.8.0 removed the ssr prop and introduced the hook solution. Could you please tell me if you are using that version? Also, the hooks.server.ts must be at src/ level, like it says in the docs https://kit.svelte.dev/docs/hooks .

— Reply to this email directly, view it on GitHub https://github.com/svelteuidev/svelteui/issues/285#issuecomment-1399548105 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ABU7EC2GBSNV2FEFJ6JRVJDWTVSTPANCNFSM6AAAAAAUCVQI7I . You are receiving this because you authored the thread.Description: Image removed by sender.Message ID: @.***>