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
In vanilla template, html file vite automatically resolves the src attribute of the img tag and other attributes. But what if my project has lazy-loading for images. I should write, for example, data-src attribute in the img tag. But vite doesn't understand, that this is a file's url, it doesn't resolve it, and doesn't put it into dist folder.
Suggested solution
Make some plugin or option, like webpack html-loader. It can "...specify which tags and attributes to process, filter them, filter urls and process sources starts with /".
Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Reacted by Bechir Ba, Seeker, Nicolas Reibnitz, Yrobot, Daniil Pankov, Kilian Finger, Alexander Eble, Xhevat Ziberi, Dan Rose, Yuta Nagamiya and 5 more
Activity
Yrobot commentedon Jun 28, 2022
Hi Guys,
Is There any quick solutions for this? Is it possible for us to update the assetAttrsConfig in vite.config.ts?
vite/packages/vite/src/node/plugins/html.ts
Lines 114 to 121 in f38654f
bluwy commentedon Jun 28, 2022
Until #7643 is merged, you can use patch-package to make the tweaks yourself first.
Yrobot commentedon Jun 28, 2022
Thanks a lot
froston commentedon Jun 19, 2023
Hi, I'm having the same issue with
data-preload="true"attribute needed for Azure B2C custom page layout.This:
results in:
Thanks!
froston commentedon Jul 3, 2023
Sharing a workaround for my issue:
ilyachernuha commentedon Jul 15, 2023
Hi! Thanks a lot @froston for sharing this! Really helps me in my project.