Astro shouldn't allow importing Image from astro/components/Image.astro
#1114
Closed
seasonedfish
started this conversation in
Proposal
Replies: 1 comment 2 replies
-
Thanks for the helpful feedback @seasonedfish! Would you mind posting this as a new issue in the Astro repo? I think it qualifies as a bug, so it would be nice to get it fixed! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Body
Summary
In Astro v4, you could directly import Image from
astro/components/Image.astro
. In v5, this appears to still be a valid import, but it causes confusing errors.Background & Motivation
When you start typing
Image
in the markup of an Astro component, VSCode offers to importImage
fromastro/components/Image.astro
(instead of fromastro:assets
, the right way):In Astro v4, this works ok, but in Astro v5, this will result in an error:
This error message is unintuitive and may result in developer frustration when upgrading from v4 to v5.
Doing a code search on the direct import statement shows hundreds of repos that make this mistake.
Goals
Proposed solutions
astro/components/Image.astro
so that it results in errors at type-check time, orAdditional info
Picture
insteadBeta Was this translation helpful? Give feedback.
All reactions