Closed WangJincheng4869 closed 6 months ago
cc @meteorlxy A real repro here: https://stackblitz.com/edit/vuepress-theme-hope-pbl7xt?file=package.json,README.md
Seems to be a serious bug.
From our docs, the base should be appended.
这个问题降级 vuepress 是没有用的,只能降级 vite 到 4 ,无法使用 vite 5
使用 vite 4 时,虽然没有在图片 src 中添加 base
,但是可以正常显示图片
使用 vite 5,图片中的 src 也没有添加 base
,就无法显示图片
Can you provide details with production? The above information is devServer.
Can you provide details with production? The above information is devServer.
我将你的复现换成了 vite4,图片可以正常显示了 https://stackblitz.com/edit/vuepress-theme-hope-umxnhe?file=package.json,docs%2FREADME.md
经过测试 build
后的结果是正常的,添加上了 base
,这个问题只是在 dev 环境下存在
cc @meteorlxy
The parsing template is not provided to Vite
for parsing, and the processing process of Vite
should be as expected. It seems that markdown-it
does not support base URL, so I think it may be more appropriate to implement a similar plugin for markdown-it.
Maybe we can port the fix https://github.com/vuejs/vitepress/issues/3239
The current fix only works on vite. A better solution might be a markdown-it plugin as @XiSenao proposed.
--- update
For webpack, you can enable markdown.assets.absolutePathPrependBase
to handle image base automatically.
Description
当配置 base 后不会处理图片地址,导致图片无法显示
Reproduction
https://stackblitz.com/edit/vuepress-theme-hope-4jgewz?file=docs%2Fdemo%2FREADME.md,docs%2F.vuepress%2Fclient.ts,docs%2F.vuepress%2Fconfig.ts
Used Package Manager
pnpm
System Info