未验证 提交 6f13956f 编写于 作者: Y Yamagishi Kazutoshi 提交者: GitHub

Unify config.image.breakpoints to config.image.sizes (#17953)

Unify the confusing `config.images.sizes` ([Image Optimizer](https://github.com/vercel/next.js/discussions/17141)) and `config.images.breakpoints` ([Image Component](https://github.com/vercel/next.js/discussions/16832)).
上级 5f7c6ae8
......@@ -27,7 +27,7 @@ type ImageProps = {
}
let imageData: any = process.env.__NEXT_IMAGE_OPTS
const breakpoints = imageData.breakpoints || [640, 1024, 1600]
const breakpoints = imageData.sizes || [640, 1024, 1600]
function computeSrc(src: string, host: string, unoptimized: boolean): string {
if (unoptimized) {
......
......@@ -16,13 +16,13 @@ describe('Next.config.js images prop without default host', () => {
nextConfig,
`module.exports = {
images: {
sizes: [480, 1024, 1600],
hosts: {
secondary: {
path: 'https://examplesecondary.com/images/',
loader: 'cloudinary',
},
},
breakpoints: [480, 1024, 1600],
},
}`,
'utf8'
......@@ -46,6 +46,7 @@ describe('Next.config.js images prop without path', () => {
nextConfig,
`module.exports = {
images: {
sizes: [480, 1024, 1600],
hosts: {
default: {
path: 'https://examplesecondary.com/images/',
......@@ -55,7 +56,6 @@ describe('Next.config.js images prop without path', () => {
loader: 'cloudinary',
},
},
breakpoints: [480, 1024, 1600],
},
}`,
'utf8'
......
module.exports = {
images: {
sizes: [480, 1024, 1600],
hosts: {
default: {
path: 'https://example.com/myaccount/',
......@@ -10,6 +11,5 @@ module.exports = {
loader: 'cloudinary',
},
},
breakpoints: [480, 1024, 1600],
},
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册