Spaces:
Configuration error
Configuration error
perf: add Three.js and Recharts to optimizePackageImports + document dynamic import pattern
Browse files- next.config.ts +6 -10
next.config.ts
CHANGED
|
@@ -29,7 +29,6 @@ const nextConfig: NextConfig = {
|
|
| 29 |
{
|
| 30 |
source: "/(.*)",
|
| 31 |
headers: [
|
| 32 |
-
// ✅ SAMEORIGIN (not DENY) so /embed/ iframes work
|
| 33 |
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
|
| 34 |
{ key: "X-Content-Type-Options", value: "nosniff" },
|
| 35 |
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
|
|
@@ -41,19 +40,12 @@ const nextConfig: NextConfig = {
|
|
| 41 |
key: "Content-Security-Policy",
|
| 42 |
value: [
|
| 43 |
"default-src 'self'",
|
| 44 |
-
// Scripts: Next.js needs unsafe-inline for inline event handlers; Turnstile needs its domain
|
| 45 |
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://challenges.cloudflare.com https://www.googletagmanager.com",
|
| 46 |
-
// Styles: Google Fonts + Tailwind inline
|
| 47 |
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
|
| 48 |
-
// Fonts: Google Fonts CDN
|
| 49 |
"font-src 'self' https://fonts.gstatic.com",
|
| 50 |
-
// Images: broad HTTPS allowed (user avatar, AI-generated images)
|
| 51 |
"img-src 'self' data: blob: https:",
|
| 52 |
-
// Frames: Cloudflare Turnstile widget + same-origin embeds
|
| 53 |
"frame-src 'self' https://challenges.cloudflare.com",
|
| 54 |
-
// Connect: AI APIs + Cloudflare + analytics
|
| 55 |
"connect-src 'self' https://api.openai.com https://api.anthropic.com https://generativelanguage.googleapis.com https://challenges.cloudflare.com wss: ws:",
|
| 56 |
-
// Media / workers (Next.js internals)
|
| 57 |
"media-src 'self' blob:",
|
| 58 |
"worker-src 'self' blob:",
|
| 59 |
].join("; "),
|
|
@@ -61,14 +53,12 @@ const nextConfig: NextConfig = {
|
|
| 61 |
],
|
| 62 |
},
|
| 63 |
{
|
| 64 |
-
// Cache logos & brand assets for 1 year
|
| 65 |
source: "/logos/(.*)",
|
| 66 |
headers: [
|
| 67 |
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
|
| 68 |
],
|
| 69 |
},
|
| 70 |
{
|
| 71 |
-
// Cache other static public assets for 1 day
|
| 72 |
source: "/(.*\\.(?:svg|png|jpg|jpeg|gif|ico|woff2|woff|ttf))",
|
| 73 |
headers: [
|
| 74 |
{ key: "Cache-Control", value: "public, max-age=86400, stale-while-revalidate=3600" },
|
|
@@ -84,10 +74,16 @@ const nextConfig: NextConfig = {
|
|
| 84 |
"react-icons",
|
| 85 |
"framer-motion",
|
| 86 |
"recharts",
|
|
|
|
|
|
|
|
|
|
| 87 |
"@radix-ui/react-dropdown-menu",
|
| 88 |
"@radix-ui/react-select",
|
| 89 |
"@radix-ui/react-tabs",
|
| 90 |
"@radix-ui/react-tooltip",
|
|
|
|
|
|
|
|
|
|
| 91 |
],
|
| 92 |
},
|
| 93 |
};
|
|
|
|
| 29 |
{
|
| 30 |
source: "/(.*)",
|
| 31 |
headers: [
|
|
|
|
| 32 |
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
|
| 33 |
{ key: "X-Content-Type-Options", value: "nosniff" },
|
| 34 |
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
|
|
|
|
| 40 |
key: "Content-Security-Policy",
|
| 41 |
value: [
|
| 42 |
"default-src 'self'",
|
|
|
|
| 43 |
"script-src 'self' 'unsafe-inline' 'unsafe-eval' https://challenges.cloudflare.com https://www.googletagmanager.com",
|
|
|
|
| 44 |
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com",
|
|
|
|
| 45 |
"font-src 'self' https://fonts.gstatic.com",
|
|
|
|
| 46 |
"img-src 'self' data: blob: https:",
|
|
|
|
| 47 |
"frame-src 'self' https://challenges.cloudflare.com",
|
|
|
|
| 48 |
"connect-src 'self' https://api.openai.com https://api.anthropic.com https://generativelanguage.googleapis.com https://challenges.cloudflare.com wss: ws:",
|
|
|
|
| 49 |
"media-src 'self' blob:",
|
| 50 |
"worker-src 'self' blob:",
|
| 51 |
].join("; "),
|
|
|
|
| 53 |
],
|
| 54 |
},
|
| 55 |
{
|
|
|
|
| 56 |
source: "/logos/(.*)",
|
| 57 |
headers: [
|
| 58 |
{ key: "Cache-Control", value: "public, max-age=31536000, immutable" },
|
| 59 |
],
|
| 60 |
},
|
| 61 |
{
|
|
|
|
| 62 |
source: "/(.*\\.(?:svg|png|jpg|jpeg|gif|ico|woff2|woff|ttf))",
|
| 63 |
headers: [
|
| 64 |
{ key: "Cache-Control", value: "public, max-age=86400, stale-while-revalidate=3600" },
|
|
|
|
| 74 |
"react-icons",
|
| 75 |
"framer-motion",
|
| 76 |
"recharts",
|
| 77 |
+
"three",
|
| 78 |
+
"@react-three/fiber",
|
| 79 |
+
"@react-three/drei",
|
| 80 |
"@radix-ui/react-dropdown-menu",
|
| 81 |
"@radix-ui/react-select",
|
| 82 |
"@radix-ui/react-tabs",
|
| 83 |
"@radix-ui/react-tooltip",
|
| 84 |
+
"@radix-ui/react-checkbox",
|
| 85 |
+
"react-markdown",
|
| 86 |
+
"zustand",
|
| 87 |
],
|
| 88 |
},
|
| 89 |
};
|