Skip to content
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

fix(mdx): don't import image component when no images are used #12921

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jan 7, 2025

Changes

Currently the rehype plugin checks if imagePaths is defined when deciding whether to inject the Image import. However since Astro 5, imagePaths is always defined, so the import was always being injected. This PR changes it to check if the list is empty.

Testing

There's a separate issuue related to responsive images that makes this hard to test correctly right now. I'll add tests as part of that.

Docs

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Jan 7, 2025
Copy link

changeset-bot bot commented Jan 7, 2025

🦋 Changeset detected

Latest commit: e42d86f

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jan 7, 2025
Copy link

changeset-bot bot commented Jan 7, 2025

🦋 Changeset detected

Latest commit: 9ff0fc1

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

@ascorbic ascorbic merged commit aeb7e1a into main Jan 7, 2025
14 checks passed
@ascorbic ascorbic deleted the mdx-image-len branch January 7, 2025 17:07
@astrobot-houston astrobot-houston mentioned this pull request Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants