vuepress-theme-hope / vuepress-theme-hope

A vuepress theme with tons of features✨
https://theme-hope.vuejs.press
MIT License
1.96k stars 689 forks source link

[Bug]在主题中配置searchPro全文检索后搜索中文浏览器报错 #4237

Open 2290774104 opened 3 days ago

2290774104 commented 3 days ago

Checklist

Package name

vuepress-theme-hope

Which operating system are you using?

Describe the bug

使用文档提供的命令创建项目后,在 theme.ts 中的 searchPro 配置 indexContent: true 时,搜索中文会导致页面报错,但 config.ts 中配置则可以正常搜索

pnpm create vuepress-theme-hope my-docs
pnpm add -D vuepress-plugin-search-pro
// theme.ts
export default hopeTheme({
  plugins: {
    searchPro: {
      indexContent: true;
    }
  }
})

这是在 theme.ts 中配置后搜索出现的错误 theme.ts配置报错

// config.ts
import { searchProPlugin } from 'vuepress-plugin-search-pro';

export default defineUserConfig({
  plugins: [
    searchProPlugin({
      indexContent: true
    }),
  ]
})

这是在 config.ts 中配置的搜索成功 config.ts配置后成功

Additional context

开发环境: node v18.20.3 npm 10.7.0 pnpm 9.4.0 项目依赖版本 "@vuepress/bundler-vite": "2.0.0-rc.14", "vue": "^3.4.27", "vuepress": "2.0.0-rc.14", "vuepress-plugin-search-pro": "2.0.0-rc.50", "vuepress-theme-hope": "2.0.0-rc.50"