vuepress / ecosystem

Official plugins and themes for VuePress2
https://ecosystem.vuejs.press
MIT License
28 stars 36 forks source link

[Bug report] ReferenceError: __COMMENT_OPTIONS__ is not defined #99

Closed undefined-hestudio closed 5 months ago

undefined-hestudio commented 6 months ago

Description

> hestudio-blog@2.0.0 docs:build C:\Users\msqlx\Documents\workdir\blog
> vuepress build src

@vuepress/plugin-blog:  ⚠ Overriding existing page:
/posts/
✔ Initializing and preparing data - done in 29.17s
⠧ Compiling with vite
(!) Some chunks are larger than 1024 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✔ Compiling with vite - done in 148.13s
✖ Rendering 106 pages - failed in 11.10s
ReferenceError: __COMMENT_OPTIONS__ is not defined
    at file:///C:/Users/msqlx/Documents/workdir/blog/node_modules/.pnpm/@vuepress+plugin-comment@2.0.0-rc.21_@waline+client@3.1.3_vuepress@2.0.0-rc.9/node_modules/@vuepress/plugin-comment/lib/client/helpers/comment.js:2:24
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
    at async file:///C:/Users/msqlx/Documents/workdir/blog/node_modules/.pnpm/@vuepress+bundler-vite@2.0.0-rc.9/node_modules/@vuepress/bundler-vite/dist/index.js:407:30
    at async file:///C:/Users/msqlx/Documents/workdir/blog/node_modules/.pnpm/@vuepress+utils@2.0.0-rc.9/node_modules/@vuepress/utils/dist/index.js:58:20
    at async build (file:///C:/Users/msqlx/Documents/workdir/blog/node_modules/.pnpm/@vuepress+bundler-vite@2.0.0-rc.9/node_modules/@vuepress/bundler-vite/dist/index.js:396:3)
    at async CAC.<anonymous> (file:///C:/Users/msqlx/Documents/workdir/blog/node_modules/.pnpm/@vuepress+cli@2.0.0-rc.9/node_modules/@vuepress/cli/dist/index.js:231:3)
 ELIFECYCLE  Command failed with exit code 1.

Reproduction

https://github.com/hestudio-community/blog

Used Package Manager

pnpm

System Info

> hestudio-blog@2.0.0 docs:info C:\Users\msqlx\Documents\workdir\blog
> vuepress info

  System:
    OS: Windows 11 10.0.22631
    CPU: (4) x64 Intel(R) Celeron(R) CPU  J1900  @ 1.99GHz
    Memory: 2.04 GB / 7.89 GB
  Binaries:
    Node: 20.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.15.5 - ~\AppData\Roaming\npm\pnpm.CMD
    bun: Not Found
  Utilities:
    Git: 2.44.0.
  Browsers:
    Chrome: Not Found
    Edge: Chromium (123.0.2420.65)
  npmPackages:
    @vuepress/bundler-vite: 2.0.0-rc.9 => 2.0.0-rc.9 
    @vuepress/bundler-webpack: Not Found
    @vuepress/cli: Not Found
    @vuepress/client: Not Found
    @vuepress/core: Not Found
    @vuepress/markdown: Not Found
    @vuepress/shared: Not Found
    @vuepress/utils: Not Found
    vue: ^3.4.21 => 3.4.21 
    vue-router: Not Found
    vuepress: 2.0.0-rc.9 => 2.0.0-rc.9
Mister-Hope commented 5 months ago

This is not a mininal reproduction

undefined-hestudio commented 5 months ago

我无法在默认主题上还原我的依赖版本,因为会出现冲突。所以我新建了具有vuepress-theme-hope的一个初始化仓库。

我对此做出的改动如下:

  1. 将依赖还原成我自己项目的版本(事实上,这是hope主题能更新到的最新依赖版本)。
  2. 修改theme.ts中关于评论的部分。
  3. 插入了client.ts代码。我认为是这里出现了问题,在我去除这一部分代码的时候,它可以正常build。如果包含了这一部分代码,它可以正常启动dev服务器,但是无法正常build,并输出了我之前提供的报错。在评论依赖的历史版本(2.0.0-rc.12),它可以正常编译。

这是我能提供的最小版本了: https://github.com/undefined-hestudio/mininal-blogsource

Mister-Hope commented 5 months ago

好的我看一下