✨ 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:
@@ -5,7 +5,18 @@ var utils = require("./lib/utils")
|
||||
const collectionName = col && col.name ? col.name : null
|
||||
const req = context.request()
|
||||
const method = req.method
|
||||
const entryId = (context.data && !Array.isArray(context.data) && context.data.id) || req.param("id") || null
|
||||
const data = /** @type {Record<string, any>} */ (Array.isArray(context.data) ? {} : context.data || {})
|
||||
let entryId = data.id || req.param("id") || null
|
||||
|
||||
// DELETE hooks may not populate context.data.id or route params consistently.
|
||||
if (!entryId) {
|
||||
const path = req.path
|
||||
const segments = path.split("/")
|
||||
const last = segments[segments.length - 1]
|
||||
if (last && last.length >= 24) {
|
||||
entryId = last
|
||||
}
|
||||
}
|
||||
|
||||
utils.clearSSRCache(collectionName, entryId, method)
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user