From 130febff94e4d5375ff864356c1e26147c4b4925 Mon Sep 17 00:00:00 2001 From: oliverlynch <59594611+oliverlynch@users.noreply.github.com> Date: Wed, 21 Aug 2024 15:45:32 +0800 Subject: [PATCH] fix(astro-engine): Add support for GIF, TIFF and AVIF image imports --- javascript-modules/engines/astro-engine/lib/builder.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/javascript-modules/engines/astro-engine/lib/builder.js b/javascript-modules/engines/astro-engine/lib/builder.js index 78f51da0..ac20c34c 100644 --- a/javascript-modules/engines/astro-engine/lib/builder.js +++ b/javascript-modules/engines/astro-engine/lib/builder.js @@ -177,7 +177,7 @@ export const buildPlugins = [ loader: "js", }; }); - build.onResolve({ filter: /^\/.*\.(svg|png|jpe?g|webp)/ }, (args) => { + build.onResolve({ filter: /^\/.*\.(svg|png|jpe?g|webp|gif|tiff|avif)/ }, (args) => { return { path: join(process.cwd(), "public", args.path) }; }); build.onLoad({ filter: /\.(j|t)sx$/ }, async (args) => { @@ -266,6 +266,9 @@ export const buildPlugins = [ args.path.endsWith(".jpg") || args.path.endsWith(".jpeg") || args.path.endsWith(".webp") || + args.path.endsWith(".gif") || + args.path.endsWith(".tiff") || + args.path.endsWith(".avif") || args.path.endsWith(".json") || args.path.endsWith(".ts") ) { @@ -321,6 +324,9 @@ export const esbuildConfigFn = (esbuildOptions, options) => { ".jpg": "file", ".jpeg": "file", ".webp": "file", + ".gif": "file", + ".tiff": "file", + ".avif": "file", ".ts": "ts", ...esbuildOptions.loader, };