From 6f0c02da114c3ce974328334c62eba94e9a3031d Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Fri, 30 Sep 2022 10:52:49 -0500 Subject: [PATCH 1/2] fix: return the original file in dev if no image transforms were used --- .../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 +++++++ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/integrations/image/src/vite-plugin-astro-image.ts b/packages/integrations/image/src/vite-plugin-astro-image.ts index 51073ee709d2..04f2303414d7 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 e586070f4bfe..598b0a8ec494 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 e70f4af136e2..105f52717423 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', From 41d3393cdc6eb85ecfd840af2a491ff2c3ae39fd Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Fri, 30 Sep 2022 10:54:10 -0500 Subject: [PATCH 2/2] chore: add changeset --- .changeset/khaki-ghosts-fry.md | 5 +++++ 1 file changed, 5 insertions(+) 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 000000000000..d2c7f647010c --- /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