Skip to content

Commit 4540c0c

Browse files
authored
fix: static content for routePrefix with subpath (#165) (#170)
1 parent f496b19 commit 4540c0c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/index-html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function indexHtml (opts) {
44
return (hasTrailingSlash) => {
5-
const prefix = hasTrailingSlash ? `.${opts.staticPrefix}` : `.${opts.prefix}${opts.staticPrefix}`
5+
const prefix = hasTrailingSlash ? `.${opts.staticPrefix}` : `${opts.prefix}${opts.staticPrefix}`
66
return `<!-- HTML for static distribution bundle build -->
77
<!DOCTYPE html>
88
<html lang="en">

test/route.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,10 @@ test('/documentation should display index html with correct asset urls', async (
548548
url: '/documentation'
549549
})
550550

551-
t.equal(res.payload.includes('href="./documentation/static/index.css"'), true)
552-
t.equal(res.payload.includes('src="./documentation/static/theme/theme-js.js"'), true)
553-
t.equal(res.payload.includes('href="./documentation/index.css"'), false)
554-
t.equal(res.payload.includes('src="./documentation/theme/theme-js.js"'), false)
551+
t.equal(res.payload.includes('href="/documentation/static/index.css"'), true)
552+
t.equal(res.payload.includes('src="/documentation/static/theme/theme-js.js"'), true)
553+
t.equal(res.payload.includes('href="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/documentation/index.css"'), false)
554+
t.equal(res.payload.includes('src="/documentation/theme/theme-js.js"'), false)
555555
})
556556

557557
test('/documentation/ should display index html with correct asset urls', async (t) => {
@@ -582,10 +582,10 @@ test('/docs should display index html with correct asset urls when documentation
582582
url: '/docs'
583583
})
584584

585-
t.equal(res.payload.includes('href="./docs/static/index.css"'), true)
586-
t.equal(res.payload.includes('src="./docs/static/theme/theme-js.js"'), true)
587-
t.equal(res.payload.includes('href="./docs/index.css"'), false)
588-
t.equal(res.payload.includes('src="./docs/theme/theme-js.js"'), false)
585+
t.equal(res.payload.includes('href="/docs/static/index.css"'), true)
586+
t.equal(res.payload.includes('src="/docs/static/theme/theme-js.js"'), true)
587+
t.equal(res.payload.includes('href="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/docs/index.css"'), false)
588+
t.equal(res.payload.includes('src="/docs/theme/theme-js.js"'), false)
589589
})
590590

591591
test('/docs/ should display index html with correct asset urls when documentation prefix is set', async (t) => {

0 commit comments

Comments
 (0)