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

Commit 3f97700

Browse files
author
X
authored
fix: fix getPreloadScripts
1 parent 82cd1f6 commit 3f97700

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

project.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,17 @@ export class Project {
260260
return [status, data]
261261
}
262262

263-
getPreloadScripts(baseUrl: string) {
263+
getPreloadScripts() {
264+
const { baseUrl } = this.config
264265
const scripts = [
265-
'-/deno.land/x/aleph/aleph.js',
266-
'-/deno.land/x/aleph/context.js',
267-
'-/deno.land/x/aleph/error.js',
268-
'-/deno.land/x/aleph/events.js',
269-
'-/deno.land/x/aleph/routing.js',
270-
'-/deno.land/x/aleph/util.js'
266+
'deno.land/x/aleph/aleph.js',
267+
'deno.land/x/aleph/context.js',
268+
'deno.land/x/aleph/error.js',
269+
'deno.land/x/aleph/events.js',
270+
'deno.land/x/aleph/routing.js',
271+
'deno.land/x/aleph/util.js'
271272
]
272-
return scripts.map(src => ({ src: `${baseUrl}${src}`, type: 'module', preload: true }))
273+
return scripts.map(src => ({ src: `${baseUrl}_aleph/-/${src}`, type: 'module', preload: true }))
273274
}
274275

275276
async getPageHtml(loc: { pathname: string, search?: string }): Promise<[number, string, Record<string, string> | null]> {
@@ -287,7 +288,7 @@ export class Project {
287288
scripts: [
288289
data ? { type: 'application/json', innerText: JSON.stringify(data), id: 'ssr-data' } : '',
289290
{ src: util.cleanPath(`${baseUrl}/_aleph/main.${mainModule.hash.slice(0, hashShort)}.js`), type: 'module' },
290-
...this.getPreloadScripts(baseUrl),
291+
...this.getPreloadScripts(),
291292
...scripts
292293
],
293294
body,
@@ -305,7 +306,7 @@ export class Project {
305306
scripts: [
306307
{ src: util.cleanPath(`${baseUrl}/_aleph/main.${mainModule.hash.slice(0, hashShort)}.js`), type: 'module' },
307308
{ src: util.cleanPath(`${baseUrl}/_aleph/-/deno.land/x/aleph/nomodule.js${this.isDev ? '?dev' : ''}`), nomodule: true },
308-
...this.getPreloadScripts(baseUrl)
309+
...this.getPreloadScripts()
309310
],
310311
head: customLoading?.head || [],
311312
body: `<main>${customLoading?.body || ''}</main>`,
@@ -392,7 +393,7 @@ export class Project {
392393
data ? { type: 'application/json', innerText: JSON.stringify(data), id: 'ssr-data' } : '',
393394
{ src: util.cleanPath(`${baseUrl}/_aleph/main.${mainModule.hash.slice(0, hashShort)}.js`), type: 'module' },
394395
{ src: util.cleanPath(`${baseUrl}/_aleph/-/deno.land/x/aleph/nomodule.js${this.isDev ? '?dev' : ''}`), nomodule: true },
395-
...this.getPreloadScripts(baseUrl),
396+
...this.getPreloadScripts(),
396397
...scripts
397398
],
398399
body,

0 commit comments

Comments
 (0)