将 Next.js 部署到 Netlify 时出现此错误。
Error: Image Optimization using Next.js default loader is not compatible with `next export`.
Possible solutions:
6:47:15 AM: - Use `next start`, which starts the Image Optimization API.
6:47:15 AM: - Use Vercel to deploy, which supports Image Optimization.
6:47:15 AM: - Configure a third-party loader in `next.config.js`.
6:47:15 AM: - Read more: https://err.sh/next.js/export-image-api.
6:47:15 AM: at exportApp (/opt/build/repo/node_modules/next/dist/export/index.js:14:712)
部署到 Vercel 时不会出现此问题。
use akamai
setting images.loader
to 'imgix'
导致开发和构建错误。
我用这个代替:
// next.config.js
module.exports = {
images: {
loader: 'akamai',
path: '',
},
}
它只适用于我关心的一切。
可能的值images.loader
是:[默认、imgix、cloudinary、akamai、自定义]
参考:https://nextjs.org/docs/api-reference/next/image#built-in-loaders https://nextjs.org/docs/api-reference/next/image#built-in-loaders
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)