Skip to content
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

[BUG] Failed to transform twikoo. #469

Closed
ghost opened this issue Feb 14, 2022 · 4 comments
Closed

[BUG] Failed to transform twikoo. #469

ghost opened this issue Feb 14, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Feb 14, 2022

Describe the bug 描述你遇到的错误

启用twikoo导致hugo构建失败。

Error: Error building site: JSBUILD: failed to transform "js/lib/twikoo.js" (application/javascript): Could not resolve "twikoo"
Built in 577 ms

Screenshots 屏幕截图

image

Build Environment 构建环境

  • OS: Windows 11 21H2 22000.434 amd64
  • Theme version/commit: v0.2.13, 212597d
  • Hugo version: hugo_extended_0.92.2_Windows-64bit

Preview Environment 预览环境

  • OS: Windows 11 21H2 22000.434 amd64
  • Browser: Chrome 98.0.4758.82

Additional Information 补充信息

我的配置文件: https://github.com/BahuangShanren/blog/blob/master/config.toml

我之前用的是LoveIt,Twikoo部署在腾讯云上,一直正常工作,既然云端正常,那大概是我博客这边没配置好?

我暂时还没有尝试使用部署在Vercel上的Twikoo,我看DoIt的 Example Site 也配置了Twikoo,我以为这是可以正常运行的案例,但当我尝试构建它时遇到了同样的报错。

@ghost ghost added the bug Something isn't working label Feb 14, 2022
@HEIGE-PCloud
Copy link
Owner

#444

关闭 config.toml 中的实验性选项

  # [Experimental] Bundle js
  bundle = false

或者在 themes/DoIt 目录下运行 npm install

@ghost
Copy link
Author

ghost commented Feb 14, 2022

感谢♥,已解决🎉

@ghost ghost closed this as completed Feb 14, 2022
@ghost
Copy link
Author

ghost commented Feb 17, 2022

Bundle js启用时,运行npm install后,twikoo前端版本是1.4.18,很好,但是通过Github Actions或者Cloudflare Pages构建时,难免会被npm install拖延一点时间;
另一方面,当Bundle js禁用时,twikoo前端版本是1.4.10,需要手动更新本地文件 DoIt/assets/lib/twikoo/twikoo.all.min.jsv1.4.18

所以建议更新 DoIt/assets/lib/twikoo/twikoo.all.min.jsv1.4.18 。顺便还有这两个文件:

  1. DoIt/assets/lib/VERSION
  2. DoIt/assets/data/cdn/jsdelivr.yml

话说,保持twikoo在1.4.10不会有什么讲究吧?

@ghost ghost reopened this Feb 17, 2022
@HEIGE-PCloud
Copy link
Owner

@BahuangShanren bundle js 的意义就是通过 package.json 和 npm 解决原先需要手动管理和更新 js 包的问题。相关的讨论:#371 #346

在重构完成之后会进行一次 breaking change 发版,要求统一使用 npm install 管理依赖。 所有 commit 进来的第三方包都会被删掉。从 exampleSite 的 CI build 来看,npm install 的开销也就十几秒,在我看来不是什么问题。

留在 1.4.10 没有什么讲究,只是手动管理依赖就会出现这种更新不及时的情况,如果能用 bundle js 就用 bundle js 选项吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant