next.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Names this build, so a tab left open across a deploy can tell it is stale
  2. // (see components/update-on-return.tsx).
  3. const SITE_BUILD =
  4. process.env.VERCEL_GIT_COMMIT_SHA || `local-${Date.now().toString(36)}`;
  5. /** @type {import('next').NextConfig} */
  6. const nextConfig = {
  7. poweredByHeader: false,
  8. env: { SITE_BUILD },
  9. experimental: {
  10. // Ship the (small) stylesheet inline so first paint never waits on a CSS request.
  11. inlineCss: true,
  12. },
  13. images: {
  14. formats: ["image/avif", "image/webp"],
  15. minimumCacheTTL: 60 * 60 * 24 * 7,
  16. remotePatterns: [
  17. {
  18. protocol: "https",
  19. hostname: "firebasestorage.googleapis.com",
  20. },
  21. {
  22. protocol: "https",
  23. hostname: "www.notion.so",
  24. },
  25. // Blog covers linked straight from their source (see coverImageUrl).
  26. {
  27. protocol: "https",
  28. hostname: "upload.wikimedia.org",
  29. },
  30. {
  31. protocol: "https",
  32. hostname: "images.unsplash.com",
  33. },
  34. ],
  35. },
  36. async headers() {
  37. const cached = [
  38. {
  39. key: "Cache-Control",
  40. value: "public, max-age=86400, stale-while-revalidate=604800",
  41. },
  42. ];
  43. return [
  44. { source: "/data/:path*", headers: cached },
  45. { source: "/emoji/:path*", headers: cached },
  46. { source: "/mini.:ext", headers: cached },
  47. ];
  48. },
  49. };
  50. module.exports = nextConfig;