-
Notifications
You must be signed in to change notification settings - Fork 3
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
Added image optimization for remote and local files #15
base: main
Are you sure you want to change the base?
Conversation
next.config.mjs
Outdated
|
||
export default nextConfig | ||
|
||
module.exports = { |
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.
🤔 why are we exporting to different configs from this file, in two different style of js modules (require
and export
). Seems a bit strange, but I'm not super familiar with Next's configuration.
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.
There was a bit of confusion here. I have submit an update to the config file as follows:
Key changes made:
- Changed file extension from .ts to .mjs
- Removed TypeScript-specific syntax (as const)
- Kept JSDoc type annotation for type checking
- Removed localPatterns as it's not a valid property in the current Next.js image config
- Maintained ES modules syntax with export default
Explanation for the changes:
- Next.js configuration must be in JavaScript (.js or .mjs), not TypeScript
- We still get type checking through JSDoc comments
- The configuration is simpler but maintains all the necessary image optimization features
- For local images in the public directory, no special configuration is needed - they work out of the box with the next/image component
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.
Based on our conversation in Slack, I think the current plan is to upgrade Next and change the extension for the config file back to .ts
.
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.
I have assigned #13 to myself in order to revert next.config.mjs
back to next.config.ts
.
Changes made:
Impact
localPAtterns
andremotePatterns
to module.exports innext.config.ts
Image
component on Vercel's frameworkImage
tag instead ofimg
, the image