Skip to content

Commit 0f330a0

Browse files
authored
fix: workaround whitespace in path (#2362)
1 parent d9850f0 commit 0f330a0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

packages/slidev/node/setups/indexHtml.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,16 @@ export default async function setupIndexHtml({ mode, entry, clientRoot, userRoot
9999
],
100100
})
101101

102-
const baseInDev = mode === 'dev' && base ? base.slice(0, -1) : ''
102+
const mainUrl = toAtFS(join(clientRoot, 'main.ts'))
103+
if (mode === 'build') {
104+
main = main.replace('__ENTRY__', mainUrl)
105+
}
106+
else {
107+
const basePrefix = base ? base.slice(0, -1) : ''
108+
main = main.replace('__ENTRY__', encodeURI(basePrefix + mainUrl))
109+
}
103110

104-
main = main
105-
.replace('__ENTRY__', baseInDev + encodeURI(toAtFS(join(clientRoot, 'main.ts'))))
106-
.replace('<!-- body -->', body)
111+
main = main.replace('<!-- body -->', body)
107112

108113
const html = await transformHtmlTemplate(unhead, main)
109114
return html

0 commit comments

Comments
 (0)