-
-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract rendering outside createInertiaApp to allow Svelte 4 & 5 comp…
…atibility
- Loading branch information
Showing
4 changed files
with
26 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import { createInertiaApp } from '@inertiajs/svelte' | ||
import createServer from '@inertiajs/svelte/server' | ||
|
||
import { render } from 'svelte/server' | ||
createServer((page) => | ||
createInertiaApp({ | ||
page, | ||
resolve: (name) => { | ||
const pages = import.meta.glob('./Pages/**/*.svelte', { eager: true }) | ||
return pages[`./Pages/${name}.svelte`] | ||
}, | ||
ssr: (AppSSR, props) => { | ||
// Svelte 4: return AppSSR.render(props) | ||
// Svelte 5: return render(AppSSR, { props }) | ||
return render(AppSSR, { props }) | ||
}, | ||
}), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters