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

fix(html): skip inlining icon and manifest links #14958

Merged
merged 4 commits into from Dec 6, 2023
Merged

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Nov 12, 2023

Description

fix #6741
fix #5962

Don't inline icon and manifest <link>s. The above issues explained why, but to summarize:

  1. Icons are low-priority-fetched by browsers, so they should be links. Otherwise user would always fetch them because it's inlined.
  2. Manifest files can't be inlined, it always needs a url.

Additional context

I'm also partially working towards supporting import img from './foo.png?inline=false (as a poc and we could also further discuss), this is a cutoff point for now to fix those issues.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines, especially the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Update the corresponding documentation if needed.
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy bluwy added feat: html p3-minor-bug An edge case that only affects very specific usage (priority) labels Nov 12, 2023
packages/vite/src/node/plugins/html.ts Outdated Show resolved Hide resolved
packages/vite/src/node/plugins/html.ts Outdated Show resolved Hide resolved
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.

💚

@bluwy
Copy link
Member Author

bluwy commented Dec 6, 2023

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

📝 Ran ecosystem CI on aa6d828: Open

suite result latest scheduled
analogjs success success
astro success success
histoire success success
ladle success success
laravel failure failure
marko success success
nuxt failure failure
nx success success
previewjs success success
qwik success success
rakkas success success
sveltekit success success
unocss success success
vike success success
vite-plugin-pwa success success
vite-plugin-react success success
vite-plugin-react-pages success success
vite-plugin-react-swc success success
vite-plugin-svelte success success
vite-plugin-vue success success
vite-setup-catalogue success success
vitepress success success
vitest success success

@bluwy bluwy merged commit 8ad81b4 into main Dec 6, 2023
10 checks passed
@bluwy bluwy deleted the skip-inline-links branch December 6, 2023 14:08
@slyshykO
Copy link

Why did you remove this feature rather than add an option to the configuration?
Why did you do this on a minor release?
Is it possible to return to the old behaviour?

@bluwy
Copy link
Member Author

bluwy commented Dec 12, 2023

Can you explain why you need the old behaviour? The previous behaviour was a bug.

@slyshykO
Copy link

Can you explain why you need the old behaviour? The previous behaviour was a bug.

I am developing a web configurator for an embedded device. So I don't need a performance for multiple downloads, cashing, etc. Also, I embed the built page in the configurator executable and receive a single file that contains everything. All files that are not inlined separately should be processed on the side of my configurator. So, it just adds work on my side.
I don't see any issues if inlining will be manipulated through options.

@bluwy
Copy link
Member Author

bluwy commented Dec 14, 2023

Thanks for explaining your usecase. Since it isn't Vite's main target audience, I think the PR still make sense. It'll be beneficial for many websites ootb. That means you're required to inline the favicon yourself in this case. Vite will only add options when really only needed: https://vitejs.dev/guide/philosophy.html#lean-extendable-core

@ArnaudBarre
Copy link
Member

For info if #15366 lands you should be able to overwrite this change (exact implementation still to be discussed)

@lapo-luchini
Copy link

For info if #15366 lands you should be able to overwrite this change

Doesn't seem to be able to force inlining.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: html p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vite inlines icon resources that should not be inlined PWA manifest issue
5 participants