dingshaohua-com / vuepress-theme-sidebar

vuepress自动根据文件生成侧边栏的主题
21 stars 0 forks source link

vuepress@2.0.0-rc.0 pnpm管理下 需要修改依赖项路径 #8

Open laerpeeK opened 9 months ago

laerpeeK commented 9 months ago

如果是使用pnpm生成的vuepress2项目。在使用该插件时,需要到以下文件修改对应路径。

  1. 打开该文件:\node_modules\vuepress-theme-sidebar\index.js
  2. 替换下述两个路径 替换 const pageFile = path.resolve("node_modules/@vuepress/theme-default/lib/client/components/Page.vue"); 为 const pageFile = path.resolve("node_modules/.pnpm/@vuepress+theme-default@2.0.0-rc.0/node_modules/@vuepress/theme-default/lib/client/components/Page.vue");

替换 const sidebarItemFile = "node_modules/@vuepress/theme-default/lib/client/components/SidebarItem.vue"; 为 const sidebarItemFile = "node_modules/.pnpm/@vuepress+theme-default@2.0.0-rc.0/node_modules/@vuepress/theme-default/lib/client/components/SidebarItem.vue";

亲测有效。

laerpeeK commented 9 months ago

也可以从源码方向去优化? 根据包管理器的不同决定引入路径? @dingshaohua-cn