next.config.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import type { NextConfig } from "next";
  2. import "./src/env";
  3. const configHeader = [
  4. // Security headers for all routes
  5. {
  6. source: "/:path*",
  7. headers: [
  8. { key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
  9. //{ key: "X-Frame-Options", value: "DENY" },
  10. { key: "X-Content-Type-Options", value: "nosniff" },
  11. // { key: "X-XSS-Protection", value: "1; mode=block" },
  12. // {
  13. // key: "Permissions-Policy",
  14. // value:
  15. // "camera=(), microphone=(), geolocation=(), browsing-topics=()",
  16. // },
  17. ],
  18. },
  19. // Cache dynamic pages - shorter cache for frequently updated content
  20. // Next.js static assets - long cache with immutable
  21. // Public folder assets - long cache
  22. ];
  23. const nextConfig: NextConfig = {
  24. output: "standalone",
  25. transpilePackages: ["@t3-oss/env-nextjs", "@t3-oss/env-core"],
  26. devIndicators: false,
  27. reactStrictMode: true,
  28. typescript: {
  29. ignoreBuildErrors: false,
  30. },
  31. images: {
  32. unoptimized: true,
  33. remotePatterns: [],
  34. },
  35. async headers() {
  36. return configHeader;
  37. },
  38. async rewrites() {
  39. return [
  40. {
  41. source: '/:slug.html',
  42. destination: '/product/:slug',
  43. },
  44. ];
  45. },
  46. compress: true,
  47. experimental: {
  48. optimizePackageImports: ["lodash", "date-fns"],
  49. serverActions: {
  50. bodySizeLimit: "2mb",
  51. },
  52. },
  53. };
  54. export default nextConfig;