Skip to content
Go back

CF 的优化导致 Astro build static file 的 script 失效

Updated:
Edit page

Astro build 后上传到 GitHub page 总是出现 script 被注释,然后刷新又好了的问题

  1. post 页面的 script 从主页进入后发现 script scope 被注释掉
  2. 查看原码有 script 但是被 cf 包裹,意识到可能是 cf 导致的问题
  3. 进入 CF 的 Configuration Rules 关闭 Auto Minify, Hotlink Protection, Email Obfuscation Security Level Essentially off
  4. 刷新生效

错误的尝试:

教训: 凡事都得先从出错的最近一层的源码查找原因,本地测试成功后不要怀疑代码问题


Edit page
Share this post on:

Previous Post
Pick the Right Distroless Base Image For Your Application
Next Post
SWAR 的理解