Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 384c63d

Browse files
committed
Fix SSG
1 parent c4077e5 commit 384c63d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

server/aleph.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ export class Aleph implements IAleph {
208208

209209
// init framework
210210
await frameworks[this.#config.framework].init(this)
211+
// compile and import framework renderer
212+
if (this.#config.ssr) {
213+
const mod = await this.compile(`${getAlephPkgUri()}/framework/${this.#config.framework}/renderer.ts`)
214+
const { render } = await this.importModule(mod)
215+
if (util.isFunction(render)) {
216+
this.#renderer.setFrameworkRenderer({ render })
217+
}
218+
}
211219
ms.stop(`init ${this.#config.framework} framework`)
212220

213221
const appFile = await findFile(srcDir, builtinModuleExts.map(ext => `app.${ext}`))
@@ -634,14 +642,6 @@ export class Aleph implements IAleph {
634642
}
635643

636644
async #renderPage(url: RouterURL, nestedModules: string[]): Promise<[string, Record<string, SSRData> | null]> {
637-
// compile and import framework renderer
638-
if (!this.#renderer.ready) {
639-
const mod = await this.compile(`${getAlephPkgUri()}/framework/${this.#config.framework}/renderer.ts`)
640-
const { render } = await this.importModule(mod)
641-
if (util.isFunction(render)) {
642-
this.#renderer.setFrameworkRenderer({ render })
643-
}
644-
}
645645
let [html, data] = await this.#renderer.renderPage(url, nestedModules)
646646
for (const callback of this.#renderListeners) {
647647
callback({ path: url.toString(), html, data })

0 commit comments

Comments
 (0)