From d82c7bdef6e442fbc92eaff5f3a0d7b950c4aae6 Mon Sep 17 00:00:00 2001 From: Barnaby Keene <1636971+Southclaws@users.noreply.github.com> Date: Fri, 27 Dec 2024 20:03:46 +0000 Subject: [PATCH] nextjs strikes again... remove image loader, won't work with API_ADDRESS at runtime... for now, just use a custom image loader that does nothing to bypass next/image rules and avoid needing to change every single component right now. --- web/next.config.js | 17 +++-------------- web/src/lib/asset/loader.js | 4 ++++ 2 files changed, 7 insertions(+), 14 deletions(-) create mode 100644 web/src/lib/asset/loader.js diff --git a/web/next.config.js b/web/next.config.js index 7596426c7..8a9d9e099 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -1,23 +1,12 @@ -/** @type {import('next').NextConfig} */ - const isStandalone = process.env.NEXT_BUILD_STANDALONE === "true"; -const API_ADDRESS = - process.env["NEXT_PUBLIC_API_ADDRESS"] ?? "http://localhost:8000"; - -const apiURL = new URL(API_ADDRESS); - +/** @type {import('next').NextConfig} */ const nextConfig = { output: isStandalone ? "standalone" : undefined, reactStrictMode: true, images: { - remotePatterns: [ - { - protocol: apiURL.protocol.replace(":", ""), - hostname: apiURL.hostname, - port: apiURL.port, - }, - ], + loader: "custom", + loaderFile: "./src/lib/asset/loader.js", }, }; diff --git a/web/src/lib/asset/loader.js b/web/src/lib/asset/loader.js new file mode 100644 index 000000000..d55afcbe4 --- /dev/null +++ b/web/src/lib/asset/loader.js @@ -0,0 +1,4 @@ +// don't even ask... TODO: remove next/image from everywhere. +export default function myHackyWorkaround({ src }) { + return src; +}