Skip to content
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

Disable Next.js image optimization #227

Merged
merged 3 commits into from
Sep 5, 2024
Merged

Disable Next.js image optimization #227

merged 3 commits into from
Sep 5, 2024

Conversation

kylegach
Copy link
Collaborator

@kylegach kylegach commented Sep 5, 2024

When enabled, either Next.js' image cache or Netlify's image CDN either serves a broken image or the incorrect one.

Notes from my investigation:

Netlify's Next.js framework docs say it should "just work":

Image optimization. The next/image component uses Netlify Image CDN by default to ensure your images are optimized and served in the most efficient format.

But given that the deployed img srcs still look like /_next/image?url=..., I'm not sure that it's working for us? The Image CDN docs state that the src would be /.netlify/images?url=.... I suppose that framework could set up a proxy rewrite from the former URL to the latter, but I don't know how to confirm that.

Well, I found their Next.js framework's source, and it contains a function that does appear to set up exactly that proxy rewrite:
https://github.com/netlify/next-runtime/blob/main/src/build/image-cdn.ts

Copy link

vercel bot commented Sep 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
web ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2024 4:01pm
web-addon-catalog ⬜️ Ignored (Inspect) Visit Preview Sep 5, 2024 4:01pm

Copy link

netlify bot commented Sep 5, 2024

Deploy Preview for storybook-frontpage ready!

Name Link
🔨 Latest commit 7ffe2f8
🔍 Latest deploy log https://app.netlify.com/sites/storybook-frontpage/deploys/66d9d57eeff2ad00080a9e0d
😎 Deploy Preview https://deploy-preview-227--storybook-frontpage.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Sep 5, 2024

Deploy Preview for storybook-addon-catalog ready!

Name Link
🔨 Latest commit 7ffe2f8
🔍 Latest deploy log https://app.netlify.com/sites/storybook-addon-catalog/deploys/66d9d57e492a6300089c39ec
😎 Deploy Preview https://deploy-preview-227--storybook-addon-catalog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kylegach kylegach changed the title More Netlify changes Disable Next.js image optimization Sep 5, 2024
@kylegach kylegach merged commit 6746ab9 into main Sep 5, 2024
12 checks passed
@kylegach kylegach deleted the more-netlify-changes branch September 5, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants