vite
vite copied to clipboard
feat: `build.assetsInlineLimit` callback
Fixes https://github.com/vitejs/vite/issues/2173 Supersedes and closes #8717
I've taken the party for the callback to override almost anything but lib mode. I've have really no strong opinion for what this callback should be able to override, for me the only need is to be able to inline images important for first paint and don't inline images at the bottom of the page.
Run & review this pull request in StackBlitz Codeflow.
Thanks for your work. I had the same idea of adding a callback to control inline of assets (https://github.com/vitejs/vite/issues/15343). However in my use case I need this for library mode. Would you mind to allow it for library mode as well?
I don't have opinion on the lib mode, I will let other team members decide on this but my advice is to look at other libs for building libraires that will have more flexibility.
LGTM 👍 Let's maybe wait for others to review or the next meeting to confirm if the priority order is fine.
Is it still possible to inline a favicon in index.html after this change? By url- or base64-encoding the image file:
<link rel="icon" type="image/svg+xml" href="<%= faviconEncoded %>" />
This throws an error if the string is too long:
[vite:build-html] ENAMETOOLONG
and prepends a / otherwise, which makes the icon not work:
href="data:image/svg+xml,%3C%3Fxml version='1.0'...
turns into:
href="/data:image/svg+xml,%3C%3Fxml version='1.0'...
Please create a new issue wit a minimal repro so we can properly track your report
Looks like it's unique to Quasar's environment anyway; I thought it was a result of the changes in this PR 😓 Cheers