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

[@astrojs/image] getImage utility throws 'ENOENT: no such file or directory' on astro build with remote images #4916

Closed
1 task done
m4rrc0 opened this issue Sep 29, 2022 · 1 comment · Fixed by #5021
Closed
1 task done
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: image Related to the `@astrojs/image` package (scope)

Comments

@m4rrc0
Copy link

m4rrc0 commented Sep 29, 2022

What version of astro are you using?

1.3.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Linux

Describe the Bug

@astrojs/image version > 0.6.1 throws ENOENT: no such file or directory ... when using the getImage utility on remote images.

Example:

---
import { getImage } from "@astrojs/image";
const image = await getImage({ ... });
---
<img {...image} />

I fixed the issue by checking for the dist/assets directory existence here but maybe there is a better place to do so.

const outputDirURL = new URL("./assets", outDir)
const outputDir = fileURLToPath(outputDirURL);
await fs.mkdir(outputDir, { recursive: true });

PS: wouldn't it make sense to allow the configuration of the assets' path in the integration config?
PPS: with some guidance I am willing to submit a pull request for this issue

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-byrnbz?file=src/pages/index.astro

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added - P4: important Violate documented behavior or significantly impacts performance (priority) pkg: image Related to the `@astrojs/image` package (scope) labels Sep 30, 2022
@matthewp matthewp self-assigned this Oct 7, 2022
@m4rrc0
Copy link
Author

m4rrc0 commented Oct 13, 2022

Fix confirmed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: image Related to the `@astrojs/image` package (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants