-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
超大vitepress 项目下,pagefind 插件不能正常工作 #226
Comments
收到我看一下 |
是单独使用 这个插件遇到的问题吗? vitepress-plugin-pagefind |
基本上是,我的文本量比较大,一开始使用 vitepress 官方自带插件可编译成功,但是无法使用,点击搜索不起作用。我已经在环境变量指定了
|
修改后有解决你的问题吗。 |
未解决,因为这个只是本地无法编译(默认文件系统有限制)。GitHub Action 一直可以编译并且会有报错。 |
OK 我记一下,晚点拿你那个仓库我试一下 |
可能不是这样,这个项目对于 vitepress 似乎看起来有些大了。即使是可能只有2000多个页面。我试过其他的官方文档的其他插件,都存在这些问题。他们是能编译出来,也有搜索框,但是搜索完全没反应。我一直在寻找优化的办法,但是还没有找到。如果你在编译的时候卡住了这可能是正常的(按照上面的链接解决文件系统的限制后),因为这个我本地 build 就一直过不去。CPU 会长时间 100%,可能是系统有问题,但是我使用的系统也是和 GitHub Action 一样的 24.04,各种软件版本也是一致的。但是 GitHub action 就能成功编译。 |
辛苦你使用最新的 vitepress-plugin-pagefind@0.3.3 再试试嘞,周末我更新了一下,解决了一那个构建阻塞的问题。 |
现在可以编译了,见https://taophilosophy.github.io/。但是所有搜索结果只有一条: |
我看了一下日志发现没有如预期的执行 pagefind,你看看在项目里把 pagefind 依赖装上,然后修改一下构建指令 ① 装依赖 pnpm add pagefind ② 构建指令添加索引生成 {
"scripts": {
"docs:build": "vitepress build docs && npx pagefind --site docs/.vitepress/dist"
}
} ③插件配置改一下 pagefindPlugin({searchOptimization:false}) |
在配置后,生成的 pc 端页面搜索框无法点击。移动端可以点击,搜索结果是 |
@ykla 迭代了一版,有空你再试试看 vitepress-plugin-pagefind@0.4.0 |
你好,本地测了一下,PC 界面无法点击搜框索。移动端可以点击,搜索结果是 #只有在构建后才生效 only support after build, only support after support。
|
好滴,我看你截图里的日志 索引文件时正常生成了的 我看一下是不是哪块配置没对上 |
我估计是插件的 transformHead 钩子没有被执行. 你手动配一下可以,配置如下 import { defineConfig } from 'vitepress'
export default defineConfig({
head: [
[
'script',
{},
`import('/pagefind/pagefind.js')
.then((module) => {
window.__pagefind__ = module
module.init()
})
.catch(() => {
// console.log('not load /pagefind/pagefind.js')
})`
]
]
}) |
回头这块 我出一个 SOP,针对插件内部分能力失效的地方 |
又迭代了一版本 vitepress-plugin-pagefind@0.4.1 有空你可以试试能不能单独使用, 如果还是不能正常工作 你就可以按照现在的方式使用我也补到文档里了 示例 7 |
请问应该如何做才能看到具体的错误信息?项目地址 https://github.com/taophilosophy/taophilosophy.github.io。奇怪的是本地按同样版本的软件配置就会无限卡住,内存 CPU 都没有变化,只有 git action 会抛出上述错误。
Git action 见 https://github.com/taophilosophy/taophilosophy.github.io/blob/main/.github/workflows/deploy.yml
找了找只看到了 vitejs/vite#13367
config.mts
:The text was updated successfully, but these errors were encountered: