Skip to content

Commit 19a1661

Browse files
committed
fix: adapt to npm package manager
1 parent 6a35209 commit 19a1661

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/vuepress-theme-reco/src/client/components/SafeRouterLink.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ if (!isServer) {
6666
setTimeout(() => {
6767
try {
6868
// 动态导入RouterLink
69-
import('vue-router').then(module => {
70-
linkComponent.value = module.RouterLink
69+
// 先尝试从 vuepress/client 中导入,这样在不同包管理器下都能正常工作
70+
import('vuepress/client').then(vuepress => {
71+
// 检查是否存在RouterLink
72+
if (vuepress.RouterLink) {
73+
linkComponent.value = vuepress.RouterLink
74+
}
7175
}).catch(e => {
7276
console.warn('SafeRouterLink: Failed to load RouterLink, using fallback link', e)
7377
})

0 commit comments

Comments
 (0)