Images not found when set the basePath parameter in next.config
Unanswered
Cape lion posted this in #help-forum
Cape lionOP
For a request I had to set the basePath parameter in the next.config.js file.
The problem is that now every Image cannot be found.
i've tried several ways but none of that were successful (images.path, assetPrefix...)
Using next@13.2.4
The problem is that now every Image cannot be found.
i've tried several ways but none of that were successful (images.path, assetPrefix...)
Using next@13.2.4
9 Replies
@Cape lion For a request I had to set the basePath parameter in the next.config.js file.
The problem is that now every Image cannot be found.
i've tried several ways but none of that were successful (images.path, assetPrefix...)
Using next@13.2.4
next/image needs manual intervention for basepath: https://nextjs.org/docs/app/api-reference/next-config-js/basePath#images (it doesn't follow the basepath setting)
i "solved" this by using
addBasePath in the image srcimport { addBasePath } from "next/dist/client/add-base-path";
const url = addBasePath("/something.png")Cape lionOP
Oh okay, fully understood! Do you think this count as bug? Should I propose a request?
im sure they have heard about it, and must have a reason
and as its on their docs, i doubt it can be a bug (as intended)
Cape lionOP
Seems to me like it's more like a way to fix this issue
Anyhow, thank you for the info 🙂
this is the first issue i found: https://github.com/vercel/next.js/issues/46454 (but im sure there are many more and ealier)
@Cape lion Seems to me like it's more like a way to fix this issue
yeah, i have just done it by the hacky basepath method, idk if there is anything better