-
-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(assets): support images outside of the project in dev #14982
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
Conversation
🦋 Changeset detectedLatest commit: c7d1a58 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
|
||
| // Vite allows loading files directly from the filesystem | ||
| // as long as they are inside the project root. | ||
| if (isParentDirectory(fileURLToPath(root), src)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure exactly what the code below here is trying to cover, because you cannot pass file paths anyway to getImage / Image so the only way you can hit it is by building a path manually, which won't anyway work in prod (well, it could, but then it wouldn't work in dev). I decided to leave it as-is just in case, but in my mind, we could remove it.
CodSpeed Performance ReportMerging #14982 will not alter performanceComparing Summary
Footnotes |
delucis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me!
Changes
When an image is using
@fs, we can fetch it directly through Vite, that way it'll automatically respect Vite's limitations in regard to which files are allowed to be loaded.Fixes #14957
Fixes #14937
Testing
We had a test for this already, but it didn't fetch the images (mostly because it was about path construction back in the day) so I updated it to actually try to fetch them
Docs
N/A