nolebase/integrations

Errors occured while using vitepress-plugin-git-changelog.

Closed this issue · 6 comments

I followed https://nolebase-integrations.ayaka.io/pages/en/integrations/vitepress-plugin-git-changelog/getting-started.html

$ pnpm docs:dev

> @ docs:dev D:\git\glom\Librorum
> vitepress dev docs


  vitepress v1.1.0

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
17:42:39 [vitepress] Pre-transform error: Failed to resolve import "virtual:nolebase-git-changelog" from "node_modules/.pnpm/@nolebase+vitepress-plugin-git-changelog@2.0.0-rc4_vitepress@1.1.0_vue@3.4.22/node_modules/@nolebase/vitepress-plugin-git-changelog/dist/client/components/Contributors.vue". Does the file exist?
17:42:39 [vitepress] Pre-transform error: Failed to resolve import "virtual:nolebase-git-changelog" from "node_modules/.pnpm/@nolebase+vitepress-plugin-git-changelog@2.0.0-rc4_vitepress@1.1.0_vue@3.4.22/node_modules/@nolebase/vitepress-plugin-git-changelog/dist/client/components/Contributors.vue". Does the file exist? (x2)
17:42:39 [vitepress] Pre-transform error: Failed to resolve import "virtual:nolebase-git-changelog" from "node_modules/.pnpm/@nolebase+vitepress-plugin-git-changelog@2.0.0-rc4_vitepress@1.1.0_vue@3.4.22/node_modules/@nolebase/vitepress-plugin-git-changelog/dist/client/components/Changelog.vue". Does the file exist?
17:42:39 [vitepress] Pre-transform error: Failed to resolve import "virtual:nolebase-git-changelog" from "node_modules/.pnpm/@nolebase+vitepress-plugin-git-changelog@2.0.0-rc4_vitepress@1.1.0_vue@3.4.22/node_modules/@nolebase/vitepress-plugin-git-changelog/dist/client/components/Changelog.vue". Does the file exist? (x2)
17:42:40 [vitepress] Internal server error: Failed to resolve import "virtual:nolebase-git-changelog" from "node_modules/.pnpm/@nolebase+vitepress-plugin-git-changelog@2.0.0-rc4_vitepress@1.1.0_vue@3.4.22/node_modules/@nolebase/vitepress-plugin-git-changelog/dist/client/components/Contributors.vue". Does the file exist?
  Plugin: vite:import-analysis
  File: D:/git/glom/Librorum/node_modules/.pnpm/@nolebase+vitepress-plugin-git-changelog@2.0.0-rc4_vitepress@1.1.0_vue@3.4.22/node_modules/@nolebase/vitepress-plugin-git-changelog/dist/client/components/Contributors.vue:4:22
  1  |  import { defineComponent as _defineComponent } from "vue";
  2  |  import { inject, onMounted, onServerPrefetch, ref } from "vue";
  3  |  import Changelog from "virtual:nolebase-git-changelog";
     |                         ^
  4  |  import { useRawPath } from "../composables/path";
  5  |  import { useCommits } from "../composables/commits";
      at formatError (file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:50877:46)
      at TransformContext.error (file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:50871:19)
      at normalizeUrl (file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:66110:33)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:66265:47
      at async Promise.all (index 2)
      at async TransformContext.transform (file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:66186:13)
      at async Object.transform (file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:51186:30)
      at async loadAndTransform (file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:53941:29)
      at async viteTransformMiddleware (file:///D:/git/glom/Librorum/node_modules/.pnpm/vite@5.2.9_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-_QLjGPdL.js:63793:32)

Env: Windows 11
Whats going on there?

Sure, i did it.
Here is my vite.config.ts

import { defineConfig } from 'vite'
import {
    GitChangelog,
    GitChangelogMarkdownSection,
} from '@nolebase/vitepress-plugin-git-changelog/vite'

export default defineConfig(async () => {
    return {
        plugins: [
            GitChangelog({
                repoURL: () => 'https://github.com/Glomzzz/Librorum',
            }),
            GitChangelogMarkdownSection({
              getChangelogTitle: (): string => {
                return '文件历史'
              },
              getContributorsTitle: (): string => {
                return '贡献者'
              },
              excludes: [
                'index.md',
              ],
            })
        ]
    }
}) 

btw, i tried running it on Linux(CentOS 9), but in vain

I guess I missed something, but i have no idea about that.

Ok, my vite.config.ts wasn't loaded correctly, I solved it by creating a new vite project.

The plugin is running perfectly right now, thanks.