Skip to content

Improve next.config.js readability and robustness with clearer path resolution and comments #39404

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

Closed
wants to merge 3 commits into from

Conversation

NirajDN
Copy link
Contributor

@NirajDN NirajDN commented Jul 19, 2025

Why:

Improved next.config.js for better readability, maintainability, and adherence to best practices.

  • Used nullish coalescing operator for safer environment variable fallback.
  • Simplified async rewrites function syntax.
  • Added meaningful comments to clarify configuration choices.
  • Ensured webpack config excludes server-only modules like fs from client bundles.

Closes:

What's being changed (if available, include any code snippets, screenshots, or gifs):

  • Refactored and cleaned up next.config.js file.
  • Improved inline comments for clarity.
  • Example update from rewrites function:
async rewrites() {
  return productIds.map((productId) => ({
    source: `/${productId}/:path*`,
    destination: `/${DEFAULT_VERSION}/${productId}/:path*`,
  }))
}

@Copilot Copilot AI review requested due to automatic review settings July 19, 2025 22:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Copy link
Contributor

github-actions bot commented Jul 19, 2025

How to review these changes 👓

Thank you for your contribution. To review these changes, choose one of the following options:

A Hubber will need to deploy your changes internally to review.

Table of review links

Note: Please update the URL for your staging server or codespace.

This pull request contains code changes, so we will not generate a table of review links.

🤖 This comment is automatically generated.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Jul 19, 2025
Copy link

@Ekene1998 Ekene1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next.config.js

@Sharra-writes
Copy link
Contributor

@NirajDN I have no idea what this does or where it's located, so...let me check into that, and then I'll know who to ask for a review (hopefully🤞).

@Sharra-writes Sharra-writes removed the triage Do not begin working on this issue until triaged by the team label Jul 21, 2025
@NirajDN
Copy link
Contributor Author

NirajDN commented Jul 22, 2025

@Sharra-writes No worries at all ,take your time! If you need the file path or any context, feel free to let me know. 😊
By the way, do you happen to be on LinkedIn? If so, I'd like to connect! 🙌

@Sharra-writes
Copy link
Contributor

@NirajDN We don't actually accept changes to this file, because it deals with how we build the site and is under the purview of our engineering team. There's supposed to be a bot that catches these and posts a comment that they can't be changed, but apparently it didn't catch this one. 🤷 Sorry, I'm going to have to close it.

@NirajDN
Copy link
Contributor Author

NirajDN commented Jul 22, 2025

@Sharra-writes No problem at all , totally understand! 😊
Thanks for letting me know, and I appreciate the clarity. Looking forward to contributing elsewhere in the project!

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.

3 participants