Added image optimization for remote and local files#15
Open
Conversation
newswim
reviewed
Jan 21, 2025
|
|
||
| export default nextConfig | ||
|
|
||
| module.exports = { |
Collaborator
There was a problem hiding this comment.
🤔 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.
Contributor
Author
There was a problem hiding this comment.
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
Collaborator
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
I have assigned #13 to myself in order to revert next.config.mjs back to next.config.ts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes made:
Impact
localPAtternsandremotePatternsto module.exports innext.config.tsImagecomponent on Vercel's frameworkImagetag instead ofimg, the image