-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 external astro image usage #4147
Fix external astro image usage #4147
Conversation
🦋 Changeset detectedLatest commit: 2a980dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Thanks! I'm assuming the Windows test failing is flakiness, will rerun. |
@crutchcorn thanks for opening this PR! How exactly will Currently the integration is depending on a custom vite plugin to parse metadata from local image files, I don't think |
@tony-sull So I actually wrote a Remark plugin that appears to work quite well for my needs outside of Vite: https://github.com/unicorn-utterances/unicorn-utterances/blob/astro/astro.config.ts#L91-L158 Specifically, the only change needed was this line to work around non-Vite execution: |
Changes
This PR is meant as somewhat of a companion piece to #4146 in order to enable running
@astrojs/image
inside ofastro.config
files.Specifically, this PR works around the issue of
import.meta.env
not being defined in non-Vite environments likeastro.config
.Testing
This was added to my local environment, and, alongside #4146 was the final blocker I needed to bypass in order to create a local
rehype-astro-image
plugin.No tests were added, since I was not sure if this required tests or even how to properly add tests that rely on non-Vite environments. Happy to add them with a bit of guidance 😄
Docs
This is a bug fix, thusly no docs are needed