fix(assets): support images outside of the project in dev#14982
Merged
Princesseuh merged 2 commits intomainfrom Dec 10, 2025
Merged
fix(assets): support images outside of the project in dev#14982Princesseuh merged 2 commits intomainfrom
Princesseuh merged 2 commits intomainfrom
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 |
Princesseuh
commented
Dec 8, 2025
|
|
||
| // Vite allows loading files directly from the filesystem | ||
| // as long as they are inside the project root. | ||
| if (isParentDirectory(fileURLToPath(root), src)) { |
Member
Author
There was a problem hiding this comment.
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 |
dadezzz
pushed a commit
to dadezzz/ice-notes
that referenced
this pull request
Dec 19, 2025
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [astro](https://astro.build) ([source](https://github.com/withastro/astro/tree/HEAD/packages/astro)) | [`5.16.5` -> `5.16.6`](https://renovatebot.com/diffs/npm/astro/5.16.5/5.16.6) |  |  | --- ### Release Notes <details> <summary>withastro/astro (astro)</summary> ### [`v5.16.6`](https://github.com/withastro/astro/blob/HEAD/packages/astro/CHANGELOG.md#5166) [Compare Source](https://github.com/withastro/astro/compare/[email protected]@5.16.6) ##### Patch Changes - [#​14982](withastro/astro#14982) [`6849e38`](withastro/astro@6849e38) Thanks [@​Princesseuh](https://github.com/Princesseuh)! - Fixes images outside the project directory not working when using astro:assets in development mode - [#​14987](withastro/astro#14987) [`9dd9fca`](withastro/astro@9dd9fca) Thanks [@​Princesseuh](https://github.com/Princesseuh)! - Fixes SVGs not working in dev mode when using the passthrough image service - [#​15014](withastro/astro#15014) [`a178422`](withastro/astro@a178422) Thanks [@​delucis](https://github.com/delucis)! - Adds support for extending the type of the props accepted by Astro’s `<Image>` component, `<Picture>` component, and `getImage()` API. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi41Mi44IiwidXBkYXRlZEluVmVyIjoiNDIuNTIuOCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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