-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Regression (beta 51) - Manifest entries for SVG assets lack information to resolve the file #1765
Comments
Experimented with the manifest generation to re-enable support for non-JS entrypoints in #1774. |
Can you explain why would you use asset as entry points in the first place? |
To take advantage of the fingerprinting performed by Rollup for assets that are linked externally (instead of imported). Example, where It enables Vite to be used in hybrid apps (HTML is rendered server-side), and cases where no JS is required, but still provide an excellent dev experience when authoring CSS, or allow caching "forever" thanks to asset fingerprinting. Without this, every backend needs to provide an alternate assets pipeline, which tend to lag behind in terms of the features or devx they provide. Is there a different way to fingerprint a non-imported asset? |
Actually I'm not sure why this has to be done through Vite. Since you have to manually specify them as entries, it means they are not used in Vite's module graph (i.e. never imported by any of the js files) - why can't you just hash them yourself? |
That might make sense when it's just fingerprinting, but CSS benefits from HMR and Vite plugins (and transformations, and in the future source maps). Referencing assets from HTML is very similar to the behavior here; this provides a way to obtain the same when not using HTML as the entry point. I understand that this is not the main approach intended for Vite, but it would indeed be useful and would open up the tooling ecosystem for other purposes. |
The thing is Vite actually is supposed to automatically eliminate empty CSS chunks. I think your use case can be better achieved with a custom |
Thanks for pointing me in the direction of |
Description 📖
When adding a non-JS and non-CSS entrypoint, such as an
.svg
, in the manifest entry:file
points to an empty JS chunk, and it can't be used to resolve the fileBackground 📜
Prior to beta 51
file
had the resolved path to the fingerprinted file.Reproduction 🐞
The issue can be replicated in this simple application, by going to the directory and running
pnpm install
andpnpm build
.Look for
logo.svg
in thepublic/vite/manifest.json
file.Logs 📜
Manifest entry:
But the fingerprinted file is actually
assets/logo.41cff365.svg
, which is not in the manifest, but is in the output dir.The text was updated successfully, but these errors were encountered: