vite icon indicating copy to clipboard operation
vite copied to clipboard

feat: `build.assetsInlineLimit` callback

Open ArnaudBarre opened this issue 1 year ago • 4 comments

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.

ArnaudBarre avatar Dec 16 '23 20:12 ArnaudBarre

Review PR in StackBlitz Codeflow 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?

freakzlike avatar Dec 16 '23 21:12 freakzlike

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.

ArnaudBarre avatar Dec 16 '23 22:12 ArnaudBarre

LGTM 👍 Let's maybe wait for others to review or the next meeting to confirm if the priority order is fine.

bluwy avatar Dec 23 '23 03:12 bluwy

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'...

duncan-oxd avatar Apr 04 '24 23:04 duncan-oxd

Please create a new issue wit a minimal repro so we can properly track your report

patak-dev avatar Apr 05 '24 05:04 patak-dev

Looks like it's unique to Quasar's environment anyway; I thought it was a result of the changes in this PR 😓 Cheers

duncan-oxd avatar Apr 05 '24 23:04 duncan-oxd