Skip to content

Commit d7eb4d4

Browse files
author
apex-ai-net
committed
fix(deploy): remove recharts from externalization to resolve Next.js 15 conflict
- Recharts was causing transpilePackages conflict in Next.js 15 - Kept framer-motion and motion externalized (used extensively) - Recharts only used in one file (chart-area-interactive.tsx) - Removed recharts from optimizePackageImports to avoid implicit transpilation - Function should stay under 250MB with just recharts bundled Note: Prerendering errors in build are separate issue (SSG + React hooks)
1 parent 9f36094 commit d7eb4d4

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

netlify.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@
6060
included_files = [".next/**/*"]
6161

6262
# Externalize large packages - they'll be available at runtime
63-
# but not bundled into the Lambda function
64-
# Note: Only server-side packages should be externalized to avoid conflicts
65-
# with Next.js transpilePackages (client UI libs are bundled normally)
63+
# but not bundled into the Lambda function (keeps function < 250MB limit)
64+
# transpilePackages: [] in next.config.ts prevents transpilation conflicts
6665
external_node_modules = [
6766
"@sentry/nextjs",
6867
"@sentry/node",
@@ -74,6 +73,8 @@
7473
"@supabase/supabase-js",
7574
"@supabase/auth-helpers-nextjs",
7675
"svix",
77-
"pg"
76+
"pg",
77+
"framer-motion",
78+
"motion"
7879
]
7980

next.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ const nextConfig: NextConfig = {
2323
'@supabase/supabase-js',
2424
'@supabase/auth-helpers-nextjs',
2525
'pg',
26-
// UI/Animation libraries removed - they conflict with transpilePackages in Next.js 15
27-
// Removed: 'recharts', 'framer-motion', 'motion'
26+
// UI/Animation libraries - externalized to keep Netlify function < 250MB
27+
// Note: recharts removed due to Next.js 15 transpilePackages conflict
28+
'framer-motion',
29+
'motion',
2830
],
2931
outputFileTracingRoot: path.join(__dirname),
3032
// Expose Sentry DSN to the client without adding new Netlify vars
@@ -183,6 +185,7 @@ const nextConfig: NextConfig = {
183185
bodySizeLimit: '10mb'
184186
},
185187
// Enable modern features for better performance
188+
// NOTE: recharts removed from optimizePackageImports to avoid transpilation conflict
186189
optimizePackageImports: [
187190
'@radix-ui/react-icons',
188191
'@radix-ui/react-dropdown-menu',
@@ -191,7 +194,6 @@ const nextConfig: NextConfig = {
191194
'@radix-ui/react-tabs',
192195
'@radix-ui/react-slider',
193196
'lucide-react',
194-
'recharts',
195197
'@tabler/icons-react',
196198
'@dnd-kit/core',
197199
'@dnd-kit/sortable',

0 commit comments

Comments
 (0)