I'm trying to add a basePath
to my next.config.js
, it works well for the website content. But all the images are broken.
// next.config.js
module.exports = {
basePath: '/my-sub-url',
assetPrefix: '/my-sub-url/'
}
I also tried adding all the image path to something like this:
src="/my-sub-url/image.jpg"
And I also tried created a my-sub-url
folder in my public
folder, but still no luck.
My codes and images are all in my GitHub private project, and I'm deploying using Vercel.com. Currently I'm in Next.js v10 canary.
Is this because I host my images in GitHub? Or any other settings that I've missed out on? Don't seem to be find anything in Vercel/Next.js docs and other online places.
question from:
https://stackoverflow.com/questions/65930789/how-does-next-js-basepath-works-for-images 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…