diff --git a/packages/integrations/image/src/get-image.ts b/packages/integrations/image/src/get-image.ts index 83ac2e5ba..10de5c039 100644 --- a/packages/integrations/image/src/get-image.ts +++ b/packages/integrations/image/src/get-image.ts @@ -113,7 +113,7 @@ export async function getImage( const isDev = globalThis.astroImage.command === 'dev'; const isLocalImage = !isRemoteImage(resolved.src); - + const _loader = isDev && isLocalImage ? globalThis.astroImage.ssrLoader : loader; if (!_loader) { @@ -130,8 +130,8 @@ export async function getImage( } const src = globalThis?.astroImage - ? globalThis.astroImage.filenameFormat(resolved, searchParams) - : `${ROUTE_PATTERN}?${searchParams.toString()}`; + ? globalThis.astroImage.filenameFormat(resolved, searchParams) + : `${ROUTE_PATTERN}?${searchParams.toString()}`; return { ...attributes, diff --git a/packages/integrations/image/src/index.ts b/packages/integrations/image/src/index.ts index da1ec1d4b..7c5176133 100644 --- a/packages/integrations/image/src/index.ts +++ b/packages/integrations/image/src/index.ts @@ -54,13 +54,10 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration = // Added to globalThis to share the same map in Node and Vite function addStaticImage(transform: TransformOptions) { staticImages.set(propsToFilename(transform), transform); - }; + } // TODO: Add support for custom, user-provided filename format functions - function filenameFormat( - transform: TransformOptions, - searchParams: URLSearchParams - ) { + function filenameFormat(transform: TransformOptions, searchParams: URLSearchParams) { if (mode === 'ssg') { return isRemoteImage(transform.src) ? path.join(OUTPUT_DIR, path.basename(propsToFilename(transform))) @@ -72,7 +69,7 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration = } else { return `${ROUTE_PATTERN}?${searchParams.toString()}`; } - }; + } // Initialize the integration's globalThis namespace // This is needed to share scope between Node and Vite @@ -82,7 +79,7 @@ const createIntegration = (options: IntegrationOptions = {}): AstroIntegration = command, addStaticImage, filenameFormat, - } + }; if (mode === 'ssr') { injectRoute({