forked from cms/tibi-svelte-starter
✨ refactor: streamline SSR setup and remove Babel configuration
- Updated import path for app.server module in SSR hook. - Removed babel.config.server.json as Babel is no longer needed for async/await transformation. - Adjusted esbuild configuration to target ESNext and modified output paths. - Enhanced App.svelte to handle initial content loading during SSR. - Updated SSR script to load messages synchronously before rendering. - Simplified build:server script in package.json by removing Babel step.
This commit is contained in:
@@ -213,8 +213,21 @@
|
||||
loading = false
|
||||
}
|
||||
|
||||
if (typeof window === "undefined") {
|
||||
;(() => {
|
||||
const initialPath = url.split("?")[0] || "/"
|
||||
const initialLang = extractLanguageFromPath(initialPath) || DEFAULT_LANGUAGE
|
||||
const initialRoutePath = stripLanguageFromPath(initialPath) || "/"
|
||||
loadContent(initialLang, initialRoutePath)
|
||||
})()
|
||||
}
|
||||
|
||||
// Re-load content when path or language changes
|
||||
$effect(() => {
|
||||
if (typeof window === "undefined") {
|
||||
return
|
||||
}
|
||||
|
||||
const lang = $currentLanguage
|
||||
const routePath = stripLanguageFromPath($location.path)
|
||||
loadContent(lang, routePath || "/")
|
||||
|
||||
Reference in New Issue
Block a user