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

Commit fda8195

Browse files
author
Je
committed
refactor: preload modules in main.js
1 parent b295e56 commit fda8195

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

project.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -748,23 +748,21 @@ export class Project {
748748
}
749749
const module = this._moduleFromURL('/main.js')
750750
const metaFile = path.join(this.buildDir, 'main.meta.json')
751-
const deps = [
752-
this.isDev && 'https://deno.land/x/aleph/hmr.ts',
753-
'https://deno.land/x/aleph/bootstrap.ts'
754-
].filter(Boolean).map(url => ({
755-
url: String(url),
756-
hash: this.#modules.get(String(url).replace(reHttp, '//').replace(reModuleExt, '.js'))?.hash || ''
757-
}))
758751

759752
module.jsContent = [
760753
this.isDev && 'import "./-/deno.land/x/aleph/hmr.js";',
754+
'import "./-/deno.land/x/aleph/aleph.js";',
755+
'import "./-/deno.land/x/aleph/context.js";',
756+
'import "./-/deno.land/x/aleph/error.js";',
757+
'import "./-/deno.land/x/aleph/events.js";',
758+
'import "./-/deno.land/x/aleph/routing.js";',
759+
'import "./-/deno.land/x/aleph/util.js";',
761760
'import bootstrap from "./-/deno.land/x/aleph/bootstrap.js";',
762761
`Object.assign(window, ${JSON.stringify({ ALEPH: (globalThis as any)['ALEPH'] }, undefined, this.isDev ? 4 : undefined)});`,
763762
`bootstrap(${JSON.stringify(config, undefined, this.isDev ? 4 : undefined)});`
764763
].filter(Boolean).join(this.isDev ? '\n' : '')
765764
module.hash = getHash(module.jsContent)
766765
module.jsFile = path.join(this.buildDir, `main.${module.hash.slice(0, hashShort)}.js`)
767-
module.deps = deps
768766

769767
try {
770768
let prevHash = ''

0 commit comments

Comments
 (0)