chore(mdx): 显式豁免 no-img-element,文档图片改为懒加载 - #400
Draft
longsizhuo wants to merge 1 commit into
Draft
longsizhuo wants to merge 1 commit into
longsizhuo wants to merge 1 commit into
Conversation
images.unoptimized=true 下 next/image 不做任何优化,且外链图片缺 width/height 会运行时报错,保留原生 <img>(与仓库其余 5 处一致用 eslint-disable-next-line)。同时加 loading="lazy" / decoding="async", 首屏外图片延迟加载以减少带宽;props 在后展开,个别图片仍可覆盖。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zBGrQgQnx1eLA9jQfSJWD
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
mdx-components.tsx有一条 eslint warning@next/next/no-img-element,建议改用next/image。为什么不换
next/imagenext.config里设了images.unoptimized: true(Vercel 图片优化额度已用完),换成next/image也不会有任何优化。source.config.ts里external: false),next/image会在运行时报错。所以保留原生
<img>,和仓库里其他 5 处写法一致,用eslint-disable-next-line加一行说明。改动
loading="lazy"和decoding="async",首屏以外的图片等滚动到了才加载,减少带宽。props放在后面展开,单张图片仍然可以覆盖这两个属性验证
tsc --noEmit通过🤖 Generated with Claude Code
https://claude.ai/code/session_014zBGrQgQnx1eLA9jQfSJWD
Generated by Claude Code