-
Notifications
You must be signed in to change notification settings - Fork 43
Perf: Optimized Next.js config for performance and security #121
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
Changes from all commits
eae0622
14f641b
3bb877b
50ec3ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||||||||
| // next.config.ts | ||||||||||||
| import type { NextConfig } from "next"; | ||||||||||||
| import createNextIntlPlugin from "next-intl/plugin"; | ||||||||||||
|
|
||||||||||||
| // ✅ Initialize i18n plugin | ||||||||||||
| const withNextIntl = createNextIntlPlugin("./src/config/i18n/request.ts"); | ||||||||||||
|
|
||||||||||||
| // ✅ Define remote image sources | ||||||||||||
| const REMOTE_IMAGE_HOSTS = [ | ||||||||||||
| "images.unsplash.com", | ||||||||||||
| "cdn.hashnode.com", | ||||||||||||
| "hashnode.imgix.net", | ||||||||||||
| "avatars.githubusercontent.com", | ||||||||||||
| "media.licdn.com", | ||||||||||||
| "media-exp1.licdn.com", | ||||||||||||
|
||||||||||||
| "media-exp1.licdn.com", | |
| "media-exp1.licdn.com", | |
| "images.lumacdn.com", |
Copilot
AI
Feb 5, 2026
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 swcMinify option is deprecated in Next.js 13+ and enabled by default. This configuration line has no effect and should be removed. SWC minification is automatically used in modern Next.js versions.
| swcMinify: true, // Faster, more efficient minification |
Copilot
AI
Feb 5, 2026
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.
Setting productionBrowserSourceMaps to false unconditionally removes source maps in production. The existing configuration (next.config.ts line 12) conditionally enables source maps based on NEXT_PUBLIC_NODE_ENV, which is more flexible for debugging production issues. Consider whether completely disabling production source maps aligns with your debugging needs.
| productionBrowserSourceMaps: false, // Security improvement | |
| productionBrowserSourceMaps: | |
| process.env.NEXT_PUBLIC_NODE_ENV === "production-debug", // Enable source maps only for explicit debug builds |
Copilot
AI
Feb 5, 2026
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.
Enabling ignoreDuringBuilds will skip ESLint checks during builds. While this may speed up CI/CD, it means linting errors will not block deployments. The existing next.config.ts has this commented out, suggesting a deliberate decision to keep linting enabled during builds. Consider whether bypassing linting checks aligns with your code quality standards.
| ignoreDuringBuilds: true, // Avoid blocking builds in CI/CD | |
| ignoreDuringBuilds: false, // Keep linting enabled so build-breaking issues are caught |
Copilot
AI
Feb 5, 2026
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 experimental.serverActions option has been stable since Next.js 14 and is enabled by default. In Next.js 16.1.5 (the version used in this project), this configuration has no effect and should be removed.
| serverActions: true, // Future scalability for server-side logic |
Copilot
AI
Feb 5, 2026
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 optimizePackageImports experimental feature has been removed. The existing configuration optimizes imports for 'lucide-react' and 'framer-motion', which are both used in this project (see package.json). Removing this optimization may negatively impact bundle size and initial load performance. Consider retaining this configuration alongside the new changes.
Copilot
AI
Feb 5, 2026
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 scrollRestoration experimental option does not exist in Next.js. The framework handles scroll restoration automatically through the built-in router. This configuration will have no effect and should be removed.
| scrollRestoration: true, // UX improvement for back/forward navigation | |
| serverActions: true, // Future scalability for server-side logic | |
| }, | |
| serverActions: true, // Future scalability for server-side logic | |
| }, |
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.
This file is named 'next.config1.ts' but should be named 'next.config.ts' to be recognized by Next.js. The current working configuration file is 'next.config.ts' in the root directory. This new file will not be used by Next.js unless the existing 'next.config.ts' is removed or renamed.