ssr #14928
ssr
#14928
-
Beta Was this translation helpful? Give feedback.
Answered by
dummdidumm
Jan 8, 2025
Replies: 2 comments 4 replies
-
I suggest to first compile your app using your toolchain (using a plugin to compile Svelte files to JS), and then use the output as an input for your JS runtime, in combination with render from import { render } from 'svelte/server';
import App from './App.svelte'; // Adjust the import path as necessary
function renderApp(props) {
const result = render(App, { props });
// if this needs to create fully qualified HTML, then add `<html>` etc, this assumes you're interested in the body HTML only
return result.body;
}
globalThis.renderApp = renderApp; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you provide a repository? Hard to say what the problem is without seeing the whole picture. Some shots in the dark:
generate: 'server'
compiler option)import { onMount } from 'svelte'
somewhere it should resolve to the server version of that import via the export map)