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

Commit 5b17d94

Browse files
committed
fix: fix jsFile path
1 parent 216b39d commit 5b17d94

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

server/app.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ export class Application implements ServerApplication {
680680
if (isRemote) {
681681
mod.jsFile = util.cleanPath(`${saveDir}/${name}.js`)
682682
} else {
683-
mod.jsFile = `${saveDir}/${name}.${mod.hash.slice(0, hashShortLength)}.js`
683+
mod.jsFile = util.cleanPath(`${saveDir}/${name}.${mod.hash.slice(0, hashShortLength)}.js`)
684684
}
685685

686686
// check previous compilation output if the source content doesn't changed.
@@ -790,15 +790,13 @@ export class Application implements ServerApplication {
790790
if (jsContent === '') {
791791
jsContent = await Deno.readTextFile(mod.jsFile)
792792
}
793-
const newContent = jsContent.replace(
794-
reHashResolve,
795-
(s, key, spaces, ql, importPath, qr) => {
796-
const importPathname = importPath.replace(reHashJs, '')
797-
if (importPathname == dep.url || importPathname === relativePathname) {
798-
return `${key}${spaces}${ql}${importPathname}.${dep.hash.slice(0, hashShortLength)}.js${qr}`
799-
}
800-
return s
793+
const newContent = jsContent.replace(reHashResolve, (s, key, spaces, ql, importPath, qr) => {
794+
const importPathname = importPath.replace(reHashJs, '')
795+
if (importPathname == dep.url || importPathname === relativePathname) {
796+
return `${key}${spaces}${ql}${importPathname}.${dep.hash.slice(0, hashShortLength)}.js${qr}`
801797
}
798+
return s
799+
}
802800
)
803801
if (newContent !== jsContent) {
804802
jsContent = newContent
@@ -813,13 +811,13 @@ export class Application implements ServerApplication {
813811
if (fsync) {
814812
await clearCompilation(mod.jsFile)
815813
await Promise.all([
816-
ensureTextFile(mod.jsFile, jsContent + (jsSourceMap ? `//# sourceMappingURL=${path.basename(mod.jsFile)}.map` : '')),
817-
jsSourceMap ? ensureTextFile(mod.jsFile + '.map', jsSourceMap) : Promise.resolve(),
818814
ensureTextFile(metaFile, JSON.stringify({
819815
url,
820816
sourceHash: mod.sourceHash,
821817
deps: mod.deps,
822818
}, undefined, 2)),
819+
ensureTextFile(mod.jsFile, jsContent + (jsSourceMap ? `//# sourceMappingURL=${path.basename(mod.jsFile)}.map` : '')),
820+
jsSourceMap ? ensureTextFile(mod.jsFile + '.map', jsSourceMap) : Promise.resolve(),
823821
])
824822
}
825823

0 commit comments

Comments
 (0)