fix: resolve page hash case-insenstively, close #202

pull/203/head
Anthony Fu 5 years ago
parent d8bf3b2886
commit 049f61e628

@ -113,7 +113,7 @@ function shouldHotReload(payload: any): boolean {
if (inBrowser) { if (inBrowser) {
const { app, router } = createApp() const { app, router } = createApp()
// wait unitl page component is fetched before mounting // wait util page component is fetched before mounting
router.go().then(() => { router.go().then(() => {
app.mount('#app') app.mount('#app')
}) })

@ -23,7 +23,7 @@ const getDefaultRoute = (): Route => ({
path: '/', path: '/',
component: null, component: null,
// this will be set upon initial page load, which is before // this will be set upon initial page load, which is before
// the app is mounted, so it's guaranteed to be avaiable in // the app is mounted, so it's guaranteed to be available in
// components // components
data: null as any data: null as any
}) })

@ -29,7 +29,7 @@ export async function renderPage(
const pageServerJsFileName = pageName + '.js' const pageServerJsFileName = pageName + '.js'
// for any initial page load, we only need the lean version of the page js // for any initial page load, we only need the lean version of the page js
// since the static content is already on the page! // since the static content is already on the page!
const pageHash = pageToHashMap[pageName] const pageHash = pageToHashMap[pageName.toLowerCase()]
const pageClientJsFileName = `assets/${pageName}.${pageHash}.lean.js` const pageClientJsFileName = `assets/${pageName}.${pageHash}.lean.js`
// resolve page data so we can render head tags // resolve page data so we can render head tags

@ -122,7 +122,7 @@ export function createVitePressPlugin(
if (isPageChunk(chunk)) { if (isPageChunk(chunk)) {
// record page -> hash relations // record page -> hash relations
const hash = chunk.fileName.match(hashRE)![1] const hash = chunk.fileName.match(hashRE)![1]
pageToHashMap![chunk.name] = hash pageToHashMap![chunk.name.toLowerCase()] = hash
// inject another chunk with the content stripped // inject another chunk with the content stripped
bundle[name + '-lean'] = { bundle[name + '-lean'] = {

Loading…
Cancel
Save