You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
...then at build time the asset is hashed, the import is replaced with const potato = '/assets/potato-xyz123.jpg', and the file is written out to that directory.
This does not happen for an ssr build. The import replacement happens, but no potato-xyz123.jpg file is written. Since it's often the case that some code is part of the server build but not part of the client build, this results in missing assets, causing bugs like sveltejs/kit#5240.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
If my client-side JavaScript imports an image...
...then at build time the asset is hashed, the import is replaced with
const potato = '/assets/potato-xyz123.jpg'
, and the file is written out to that directory.This does not happen for an
ssr
build. Theimport
replacement happens, but nopotato-xyz123.jpg
file is written. Since it's often the case that some code is part of the server build but not part of the client build, this results in missing assets, causing bugs like sveltejs/kit#5240.Reproduction
https://github.com/Rich-Harris/vite-ssr-assets
Steps to reproduce
git clone git@github.com:Rich-Harris/vite-ssr-assets cd vite-ssr-assets npm install npm run build
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: