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

Commit c4077e5

Browse files
committed
Improve frame init perfermance
1 parent 0032052 commit c4077e5

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

framework/mod.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { init } from './react/init.ts'
2+
3+
export const frameworks = {
4+
react: { init: init }
5+
}

server/aleph.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { wasmChecksum, parseExportNames, SourceType, fastTransform, transform, s
1010
import { EventEmitter } from '../framework/core/events.ts'
1111
import { builtinModuleExts, toPagePath, trimBuiltinModuleExts } from '../framework/core/module.ts'
1212
import { Routing } from '../framework/core/routing.ts'
13+
import { frameworks } from '../framework/mod.ts'
1314
import { cssLoader } from '../plugins/css.ts'
1415
import { ensureTextFile, existsDir, existsFile, lazyRemove } from '../shared/fs.ts'
1516
import log, { Measure } from '../shared/log.ts'
@@ -206,9 +207,7 @@ export class Aleph implements IAleph {
206207
}
207208

208209
// init framework
209-
const { init } = await import(`../framework/${this.#config.framework}/init.ts`)
210-
await init(this)
211-
210+
await frameworks[this.#config.framework].init(this)
212211
ms.stop(`init ${this.#config.framework} framework`)
213212

214213
const appFile = await findFile(srcDir, builtinModuleExts.map(ext => `app.${ext}`))

0 commit comments

Comments
 (0)