You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The list of html tags pointing to resources that are transformed into assets by vite is listed here: https://vite.dev/guide/features.html#html
But what if I have a following scenario when using lightbox library such as simplelightbox where the thumbnails are enclosed with tags pointing to original pictures like this:
so after build it points to a file that does not exist in the bundle and that breaks the lightbox. Even without ligtbox context I can imagine is not that uncommon to use tag to point to an image directly and that just won't work properly after build.
Suggested solution
Why not add the <a> tag pointing to an file (probably excluding .html extension) to the list of transformed resources like it's the case with <img> and quite few other tags ?
If there is too high risk of breaking something maybe that could be implemented as either an optional setting in vite.config.js or on per-tag basis by adding attribute like vite-asset like this:
<ahref="path/to/img.jpg" vite-asset>click to open an image</a>
alternatively using parameter appended tu the url:
<ahref="path/to/img.jpg?vite_asset">click to open an image</a>
If there is some setting that I'm not aware of or any elegant solution to workaround the issue for now it would be much appreciated if someone could suggest such.
Description
The list of html tags pointing to resources that are transformed into assets by vite is listed here:
https://vite.dev/guide/features.html#html
But what if I have a following scenario when using lightbox library such as simplelightbox where the thumbnails are enclosed with tags pointing to original pictures like this:
The
img src
is transformed to point to an asset after build but thea href
is notso after build it points to a file that does not exist in the bundle and that breaks the lightbox. Even without ligtbox context I can imagine is not that uncommon to use tag to point to an image directly and that just won't work properly after build.
Suggested solution
Why not add the
<a>
tag pointing to an file (probably excluding .html extension) to the list of transformed resources like it's the case with<img>
and quite few other tags ?If there is too high risk of breaking something maybe that could be implemented as either an optional setting in
vite.config.js
or on per-tag basis by adding attribute likevite-asset
like this:alternatively using parameter appended tu the url:
If there is some setting that I'm not aware of or any elegant solution to workaround the issue for now it would be much appreciated if someone could suggest such.
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: