Skip to content
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

feat: build.assetsInlineLimit callback #15366

Merged
merged 5 commits into from
Jan 12, 2024

Conversation

ArnaudBarre
Copy link
Member

@ArnaudBarre ArnaudBarre commented Dec 16, 2023

Fixes #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.

Copy link

stackblitz bot commented Dec 16, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@freakzlike
Copy link

freakzlike commented Dec 16, 2023

Thanks for your work. I had the same idea of adding a callback to control inline of assets (#15343). However in my use case I need this for library mode. Would you mind to allow it for library mode as well?

@ArnaudBarre
Copy link
Member Author

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.

packages/vite/src/node/plugins/asset.ts Outdated Show resolved Hide resolved
packages/vite/src/node/plugins/asset.ts Outdated Show resolved Hide resolved
@bluwy bluwy added the p3-significant High priority enhancement (priority) label Dec 22, 2023
@bluwy
Copy link
Member

bluwy commented Dec 23, 2023

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

@bluwy bluwy added this to the 5.1 milestone Dec 23, 2023
sapphi-red
sapphi-red previously approved these changes Dec 30, 2023
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some tiny suggestions.

packages/vite/src/node/plugins/asset.ts Outdated Show resolved Hide resolved
packages/vite/src/node/plugins/asset.ts Outdated Show resolved Hide resolved
patak-dev
patak-dev previously approved these changes Jan 10, 2024
@patak-dev patak-dev enabled auto-merge (squash) January 12, 2024 08:51
@patak-dev patak-dev merged commit 4d1342e into main Jan 12, 2024
10 checks passed
@patak-dev patak-dev deleted the arnaud/assetsInlineLimit-callback branch January 12, 2024 08:56
@duncan-oxd
Copy link

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

@patak-dev
Copy link
Member

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

@duncan-oxd
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-significant High priority enhancement (priority)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add build.assetInlineExclude config
6 participants