-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Compiled a wrong asset path(‘/base/’ prefix) in the development environment #3239
Comments
That is correct actually. Even in rc.25 after build you'll get paths like In rc.26 we switched to vite 5, which disallows serving files outside base (vitejs/vite#5657). This is also correct behavior IMO. The inconsistency in dev and build should be fixed though. In the meantime, please use relative paths - |
I may not have explained the main point of problem clearly 😢 Whether in rc.25 or rc.26, the image resource path will be compiled as the correct(same) result:
But, In the development environment, they behave differently:
|
Yeah, I understood your problem. The issue is vite 4 (rc 25) served |
Describe the bug
When I:
The problem of compilating wrong assets path does not have any issues in production environment (when you 'npm run docs: build' and 'npm run docs: preview'), only occurs in the development environment.
Reproduction
Init project
Create directory structure
Add
base
property in.vitepress/config.mts
Add a image in
index.md
![cat](/assets/image/cat.png)
Start development environment
npm run docs:dev
Then, in the network-panel(chrome dev-tool) you will find that the image request is 404.
open the dom-panel and modify the image path from '/assets/image/cat. png' to '/base/assets/image/cat. png', it will be normal.
However, if you install
vitepress@vitepress V1.0.0-rc.25
, everything is normal. It seems that there has been a breaking-change in the asset path compilation, but I did not see it in the CHANGLOG.Expected behavior
In the development environment
System Info
Additional context
I really want to fix this issue, but I can't located yet😢 ...
Validations
The text was updated successfully, but these errors were encountered: