nolebase / integrations

A collection of diverse documentation engineering tools | 多元化的文档工程工具合集
https://nolebase-integrations.ayaka.io
MIT License
66 stars 9 forks source link

Uncaught Error: Could not resolve "asciinema-player/dist/bundle/asciinema-player.css" imported by "@nolebase/ui". Is it installed? #183

Closed northword closed 1 month ago

northword commented 1 month ago

尊敬的开发者,您好!

感谢您的工作!

我在使用 vitepress-plugin-git-changelog 时,依照文档配置了如下内容:

// .vitepress/config.ts
import {
  GitChangelog,
  GitChangelogMarkdownSection,
} from "@nolebase/vitepress-plugin-git-changelog/vite";

export default defineConfig({
  vite: {
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
      GitChangelog({
        repoURL: () => "https://github.com/zotero-chinese/website",
      }),
      GitChangelogMarkdownSection(),
    ],
    // @ts-ignore
    ssr: {                     // 虽然这里会报错 ssr 不在,但是经过测试确实是可以的,且 vuejs 官方文档仓库也这样用
      noExternal: [
        "element-plus",
        "highcharts",
        "highcharts-vue",
        "@highcharts/dashboards",
        "@nolebase/vitepress-plugin-git-changelog",   // 文档未提及这一行,我看您仓库里加了这个,且不加这一行会报错
      ],
    },
  },
});
// .vitepress/theme/index.ts
import { h } from "vue";
import type { Theme } from "vitepress";
import DefaultTheme from "vitepress/theme";
import "./styles/vars.css";
import HomeSponsors from "./components/HomeSponsors.vue";
// import AsideSponsors from "./components/AsideSponsors.vue";
import SvgImage from "./components/SvgImage.vue";
import "element-plus/theme-chalk/dark/css-vars.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import { NolebaseGitChangelogPlugin } from "@nolebase/vitepress-plugin-git-changelog/client";
import "@nolebase/vitepress-plugin-git-changelog/client/style.css";

export default {
  extends: DefaultTheme,
  Layout() {
    return h(DefaultTheme.Layout, null, {
      // "home-features-after": () => h(HomeSponsors),
      // "aside-ads-before": () => h(AsideSponsors),
    });
  },
  enhanceApp({ app }) {
    app.component("SvgImage", SvgImage);
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component);
    }
    app.use(NolebaseGitChangelogPlugin);
  },
} satisfies Theme;

但是 vitepress dev 后,得到白屏,控制台报错

ui:1 Uncaught Error: Could not resolve "asciinema-player/dist/bundle/asciinema-player.css" imported by "@nolebase/ui". Is it installed?

但我并没有使用 asciinema-player

我观察到 https://github.com/nolebase/integrations/pull/182/files 中涉及到了这些 CSS 的更改,但是 rc9.0 发布失败了。如果是 rc 9.0 已经解决此问题,可以麻烦重新发布一下吗?

如果是我在其他方面操作错误了,可以请教一下可能是哪里的错误嘛?

安装版本:

    "@nolebase/vitepress-plugin-git-changelog": "2.0.0-rc8",
    "vitepress": "1.1.3",
    "vue": "3.4.23"
    "vite": "5.2.10",

仓库地址:https://github.com/zotero-chinese/website/tree/feat/git-changelog

再次感谢您的工作!

nekomeowww commented 1 month ago

@northword 啊,抱歉我早上发布之后忘记追踪发布状态了,我现在看一下,尽快给你反馈。

LittleSound commented 1 month ago

但我并没有使用 asciinema-player。

我观察到 https://github.com/nolebase/integrations/pull/182/files 中涉及到了这些 CSS 的更改,但是 rc9.0 发布失败了。如果是 rc 9.0 已经解决此问题,可以麻烦重新发布一下吗?

如果是我在其他方面操作错误了,可以请教一下可能是哪里的错误嘛?

很抱歉给你造成了困扰,不是你的操作有误的问题,是我们这边导致的,我们现在已经发布了新的 v2.0.0-rc10,可以请你再尝试重新升级一下试试看吗?

northword commented 1 month ago

收到,我明早试一下,感谢您的快速响应!

northword commented 1 month ago

你好,我更新 rc10 后,这个问题已经解决了,非常感谢!

有另一个问题是,请问插件是不支持 git submodule 吗?

我在我的项目中,把文档作为了一个单独的仓库 wiki,然后在 website 仓库中,把 wiki 仓库以子模块的方式放在 src/wiki,并在 vitepress 中配置重写 wiki/src/:id+:id+ 。在插件中,配置了如下:

export default defineConfig({
  srcDir: "./src",
  srcExclude: ["**/wiki/*.md", "**/plugins/backend/**/*.*"],
  outDir: "dist",

  rewrites: {
    "wiki/src/:id+": ":id+",
  },

  vite: {
    plugins: [
      GitChangelog({
        // includeDirs: ["src/wiki"],
        rewritePaths: {
          "src/wiki/src/": "",
          "src/": "",
        },
        repoURL: () => "https://github.com/zotero-chinese/website",
      }),
      GitChangelogMarkdownSection({
        // exclude: (id) => !id.match("src/wiki/"),
      }),
    ],
    // @ts-ignore
    ssr: {
      noExternal: [
        "@nolebase/vitepress-plugin-git-changelog",
      ],
    },
  },
});

这样配置时,website 仓库 src/plugins/index.md 可以正常显示changelog,但是 src/wiki 并不能,似乎是插件不能够从 website 仓库读取到 wiki 仓库的 git log,请问是这样嘛?

nekomeowww commented 1 month ago

是的,你的理解非常正确。

主要是我们在过去的实践和所参考的 VueUse 这样的项目中的 git log 相关的使用和集成的经验和具备的知识并不多,我只有在搞 Python 相关的模块和 Hugo 相关的主题模块的时候会用到 submodule,感觉可以加一下支持,我们添加一个子仓库在里面放数据应该就好。

.
└── website
    └── src
        └── wiki

是这样的结构吗?

那我们关闭这个 Issue,然后新开一个有关支持 Git Submodule 的 Feature Request Issue 如何?

northword commented 1 month ago

是的,非常感谢!

nekomeowww commented 1 month ago

那交给你来开启下一部分的 issue 吧!