From 64a1d712efd3cc80c0b9aed9f2ead1487f8db07b Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Fri, 30 Sep 2022 17:27:56 +0000 Subject: [PATCH] [@astrojs/image] fixes a bug in dev when is used with no transformation props (#4933) * fix: return the original file in dev if no image transforms were used * chore: add changeset --- .changeset/khaki-ghosts-fry.md | 5 +++++ .../image/src/vite-plugin-astro-image.ts | 16 ++++++++++------ .../fixtures/basic-image/src/pages/index.astro | 2 ++ .../integrations/image/test/image-ssg.test.js | 6 ++++++ .../image/test/image-ssr-dev.test.js | 7 +++++++ 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 .changeset/khaki-ghosts-fry.md diff --git a/.changeset/khaki-ghosts-fry.md b/.changeset/khaki-ghosts-fry.md new file mode 100644 index 000000000..d2c7f6470 --- /dev/null +++ b/.changeset/khaki-ghosts-fry.md @@ -0,0 +1,5 @@ +--- +'@astrojs/image': patch +--- + +Fixes a bug in dev when `` is used for a local image with no transformations diff --git a/packages/integrations/image/src/vite-plugin-astro-image.ts b/packages/integrations/image/src/vite-plugin-astro-image.ts index 51073ee70..04f230341 100644 --- a/packages/integrations/image/src/vite-plugin-astro-image.ts +++ b/packages/integrations/image/src/vite-plugin-astro-image.ts @@ -93,16 +93,20 @@ export function createPlugin(config: AstroConfig, options: Required social-jpg
+ no-transforms +
Google
inline diff --git a/packages/integrations/image/test/image-ssg.test.js b/packages/integrations/image/test/image-ssg.test.js index e586070f4..598b0a8ec 100644 --- a/packages/integrations/image/test/image-ssg.test.js +++ b/packages/integrations/image/test/image-ssg.test.js @@ -28,6 +28,12 @@ describe('SSG images - dev', function () { url: '/@astroimage/assets/social.jpg', query: { f: 'jpg', w: '506', h: '253' }, }, + { + title: 'Local image no transforms', + id: '#no-transforms', + url: '/@astroimage/assets/social.jpg', + query: { } + }, { title: 'Filename with spaces', id: '#spaces', diff --git a/packages/integrations/image/test/image-ssr-dev.test.js b/packages/integrations/image/test/image-ssr-dev.test.js index e70f4af13..105f52717 100644 --- a/packages/integrations/image/test/image-ssr-dev.test.js +++ b/packages/integrations/image/test/image-ssr-dev.test.js @@ -32,6 +32,13 @@ describe('SSR images - dev', function () { query: { f: 'jpg', w: '506', h: '253' }, contentType: 'image/jpeg', }, + { + title: 'Local image no transforms', + id: '#no-transforms', + url: '/@astroimage/assets/social.jpg', + query: { }, + contentType: 'image/jpeg', + }, { title: 'Filename with spaces', id: '#spaces',