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

[fix] fix typo - missing ; for " #469

Merged
merged 1 commit into from
May 22, 2024
Merged

Conversation

calfzhou
Copy link
Contributor

@calfzhou calfzhou commented May 21, 2024

article_footer 里 wechat 分享按钮的地方," 少写了一个分号。此 PR 修复该问题。

这个问题会导致通过 terser 对 html 内的 js 压缩的时候语法解析失败。

复现方式:

_config.stellar.ymlarticle.share 配置中确保添加了 wechat,开启 wechat 分享按钮。

以基于 @uiolee/hexo-htmlnano 插件为例,对构建物进行压缩:

pnpm add @uiolee/hexo-htmlnano cssnano postcss terser svgo
hexo generate

进行压缩的时候,terser 会报错:

SyntaxError: Unterminated string constant
    at js_error (/node_modules/.pnpm/[email protected]/node_modules/terser/dist/bundle.min.js:536:11)
    at parse_error (/node_modules/.pnpm/[email protected]/node_modules/terser/dist/bundle.min.js:672:9)
    at /node_modules/.pnpm/[email protected]/node_modules/terser/dist/bundle.min.js:1043:36
    at Object.next_token [as input] (/node_modules/.pnpm/[email protected]/node_modules/terser/dist/bundle.min.js:1076:40)
    ......

并导致所有开启了 wechat 分享按钮的页面压缩后的 html 代码均为空。

Copy link

stackblitz bot commented May 21, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@xaoxuu xaoxuu merged commit b9b9324 into xaoxuu:main May 22, 2024
@xaoxuu
Copy link
Owner

xaoxuu commented May 22, 2024

感谢大佬🙏

lliei0x pushed a commit to lliei0x-x/hexo-theme-stellar that referenced this pull request Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants