skip to content

Astro 插件警告

/ 2 min read

升级到 Astro 6.4 后,构建时可能会看到这样一条警告:

[astro] `markdown.remarkPlugins`, `markdown.rehypePlugins`, and `markdown.remarkRehype` are deprecated...

即使 astro.config.ts 已经使用了新的 processor: unified({...}) 写法,警告仍然出现。原因出在 astro-expressive-code 集成内部。

问题根源

astro-expressive-code v0.42.0 的源码中(dist/index.js:358-374)仍然使用旧 API:

updateConfig({
markdown: {
syntaxHighlight: false,
rehypePlugins: [[rehypeExpressiveCode, rehypeExpressiveCodeOptions]]
}
});

Astro 6.4 的 validate.js 检测到 markdown.rehypePlugins 被设置,就会触发这条过期警告。

现状总结

项目状态
你的 astro.config.ts✅ 已是新写法,无需修改
astro-expressive-code v0.42.0❌ 内部仍用旧 API
警告性质仅警告,不影响功能

Astro 内部会自动把旧式插件合并到你的 unified() processor 中,所以构建和运行完全正常。

处理建议

这是 astro-expressive-code 的上游 bug,需要等它发布新版本适配 Astro 6.4 的 markdown.processor API。

  • 暂时忽略 — 警告无害,不影响构建和运行
  • 关注上游更新astro-expressive-code 发布修复版本后执行 bun update 即可

不需要修改任何配置文件。