diff --git a/src/client/app/components/Content.ts b/src/client/app/components/Content.ts index cf2ff4aa..688f9d6e 100644 --- a/src/client/app/components/Content.ts +++ b/src/client/app/components/Content.ts @@ -6,7 +6,7 @@ export const Content = { setup() { const route = useRoute() - if (process.env.NODE_ENV === 'production') { + if (import.meta.env.PROD) { // in prod mode, enable intersectionObserver based pre-fetch usePrefetch() } diff --git a/src/client/app/composables/preFetch.ts b/src/client/app/composables/preFetch.ts index 59171bb4..affa6031 100644 --- a/src/client/app/composables/preFetch.ts +++ b/src/client/app/composables/preFetch.ts @@ -72,10 +72,10 @@ export function usePrefetch() { }) rIC(() => { - document.querySelectorAll('.vitepress-content a').forEach((link) => { + document.querySelectorAll('#app a').forEach((link) => { const { target, hostname, pathname } = link as HTMLAnchorElement if ( - // only prefetch same page navigation, since a new page will load + // only prefetch same tab navigation, since a new tab will load // the lean js chunk instead. target !== `_blank` && // only prefetch inbound links