-
Notifications
You must be signed in to change notification settings - Fork 86
chore: replace next/legacy/image with next/image #1722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-export-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-edge-middleware ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-plugin-canary ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for next-i18next-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for nextjs-plugin-custom-routes-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for netlify-plugin-nextjs-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
4067b67
to
5e906fa
Compare
2b583e5
to
faeabe8
Compare
'image has natural width' | ||
).to.be.greaterThan(0) | ||
}) | ||
cy.findByRole('img', { name: /tawny frogmouth/i }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prettier in action
@@ -71,7 +71,7 @@ module.exports = { | |||
}, | |||
// https://nextjs.org/docs/basic-features/image-optimization#domains | |||
images: { | |||
domains: ['raw.githubusercontent.com', 'upload.wikimedia.org'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed 'upload.wikimedia.org'
, as it was added a few weeks ago to prevent the /images
page in the default demo from breaking due to Next.js throwing when the host is not supported for an image.
Why is this based off the app dir branch? |
@ascorbic, I could've swarn these changes were related to the work in your branch, but pulling latest from main shows that is clearly not the case. Thursdays. |
beadf65
to
ab989a5
Compare
I think the confusion was because it's Next 13 stuff - but it was the other PR that we already merged. |
@@ -615,7 +614,7 @@ describe('onBuild()', () => { | |||
const imageConfigPath = path.join(constants.INTERNAL_FUNCTIONS_SRC, IMAGE_FUNCTION_NAME, 'imageconfig.json') | |||
const imageConfigJson = await readJson(imageConfigPath) | |||
|
|||
expect(imageConfigJson.domains.length).toBe(2) | |||
expect(imageConfigJson.domains.length).toBe(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wikipedia domain was removed, so now there is only one domain. See https://github.com/netlify/next-runtime/pull/1722/files#diff-f3bc73930689da34c69d4dd219fb06b3965a303551a6b4fe527b2492534511e6L74
).to.equal('0px') | ||
it('should show throw if an image is not on the domains or remotePatterns allowlist', () => { | ||
cy.request('/broken-image').then((response) => { | ||
expect(response.status).to.eq(200) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The image is broken, but the page still loads with the error message which is why this is an HTTTP 200
3289bb1
to
6da578a
Compare
0e2cb05
to
dbd8558
Compare
19be202
to
b16d251
Compare
b16d251
to
5cf563d
Compare
This was passing minus the preview spec flakiness, but I've rerun things and atm it's failing because things are timing out on waiting for sites to build. I'll let it rest for a bit and rerun later this afternoon. |
Summary
Swaps
next/legacy/image
imports withnext/image
imports. I've also added a test to verify that a broken image due to image configuration in Next.js should error out if the host is not allowed.Test plan
All the demo sites should build fine and all the tests should pass.
Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal
Closes #1721
Standard checks:
🧪 Once merged, make sure to update the version if needed and that it was published correctly.