Open stephanbogner opened 2 years ago
src="undefined" when using the format option
src="undefined"
npm create astro@latest
1.4.7"
npm install astro-imagetools
0.6.11
astro.config.mjs
import { astroImageTools } from "astro-imagetools"; export default { integrations: [astroImageTools], };
/public
/pages/index.astro
--- import { Img } from "astro-imagetools/components"; import Layout from '../layouts/Layout.astro'; --- <Layout title="Welcome to Astro."> <Img src="/the-nix-company-ljvm17bH-e0-unsplash.jpeg" alt="A random image" /> </Layout>
astro-imagetools.config.mjs
import { defineConfig } from "astro-imagetools/config"; export default defineConfig({ format: ["webp", "jpg"] });
Generated img tag:
<img src="undefined" alt="A random image" srcset="/assets/the-nix-company-ljvm17bH-e0-unsplash@320w.719a2856.webp 320w, /assets/the-nix-company-ljvm17bH-e0-unsplash@840w.74347f00.webp 840w, /assets/the-nix-company-ljvm17bH-e0-unsplash@1286w.a64e271f.webp 1286w, /assets/the-nix-company-ljvm17bH-e0-unsplash@1657w.9c355a1e.webp 1657w, /assets/the-nix-company-ljvm17bH-e0-unsplash@1954w.c1b93de0.webp 1954w, /assets/the-nix-company-ljvm17bH-e0-unsplash@2177w.54e4f1e1.webp 2177w, /assets/the-nix-company-ljvm17bH-e0-unsplash@2326w.fc352684.webp 2326w, /assets/the-nix-company-ljvm17bH-e0-unsplash@2400w.ee938d08.webp 2400w" sizes="(min-width: 2400px) 2400px, 100vw" width="2400" height="3595" loading="lazy" decoding="async" class="astro-imagetools-img astro-imagetools-img-7C93DA38" style="display: inline-block; overflow: hidden; vertical-align: middle; ; max-width: 100%; height: auto;" onload="">
The same as above but with a src.
src
I have the same problem.
Having the same issue.
Same issue
Issue
src="undefined"
when using the format optionHow to reproduce:
npm create astro@latest
(in my case version1.4.7"
)npm install astro-imagetools
(in my case version0.6.11
)astro.config.mjs
with content from docs/public
, e.g. this one/pages/index.astro
:astro-imagetools.config.mjs
and set:Result
Generated img tag:
Expected Result:
The same as above but with a
src
.Test with empty config
import { defineConfig } from "astro-imagetools/config"; export default defineConfig({ });Generated image tag with correct src: