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:
2026-05-12 15:47:53 +00:00
parent e84b87ed16
commit 4a604bab0b
9 changed files with 11844 additions and 51 deletions
+11 -5
View File
@@ -10,15 +10,21 @@ if (!fs.existsSync(__dirname + "/api/hooks/lib/buildInfo.js")) {
}
config.writeBuildInfo = null
config.options.sourcemap = "inline"
config.options.sourcemap = true
config.options.minify = false
config.options.platform = "node"
config.options.format = "cjs"
// es2015 will transform async/await to generators, but not working with svelte
// so we need babel to transform async/await to promises
// config.options.target = "es2015"
// Keep modern syntax that goja supports natively and downlevel only unsupported features.
config.options.target = "esnext"
config.options.supported = { "async-await": false, "async-generator": false, "dynamic-import": false }
config.options.entryPoints = ["./frontend/src/ssr.ts"]
config.options.outfile = __dirname + "/_temp/app.server.js"
config.options.outfile = __dirname + "/api/hooks/lib/app.server.js"
// Remove splitting-related options inherited from the frontend build.
delete config.options.outdir
delete config.options.splitting
delete config.options.entryNames
delete config.options.chunkNames
delete config.options.outExtension
config.options.plugins = [
config.sveltePlugin({
compilerOptions: {