-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
156 lines (139 loc) · 4.37 KB
/
next.config.js
File metadata and controls
156 lines (139 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/** @type {import('next').NextConfig} */
// Disable bundle analyzer for now to avoid potential issues
let withBundleAnalyzer = (config) => config
const nextConfig = {
// Silence Next.js 16 Turbopack warning by acknowledging we have webpack config
turbopack: {},
// Configurações básicas
reactStrictMode: true,
// Better error handling in development
...(process.env.NODE_ENV === 'development' && {
onDemandEntries: {
// Period (in ms) where the server will keep pages in the buffer
maxInactiveAge: 25 * 1000,
// Number of pages that should be kept simultaneously without being disposed
pagesBufferLength: 2,
},
}),
// Configurações de imagem - Otimizadas para Netlify
images: {
// Image optimization enabled for Netlify
formats: ['image/webp', 'image/avif'],
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
remotePatterns: [
{
protocol: 'http',
hostname: 'localhost',
port: '3000',
pathname: '/**',
},
{
protocol: 'https',
hostname: '*.netlify.app',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'armazemsaojoaquim.com.br',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'armazemsaojoaquim.netlify.app',
pathname: '/**',
},
{
protocol: 'https',
hostname: '*.supabase.co',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'enolssforaepnrpfrima.supabase.co',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'via.placeholder.com',
pathname: '/**',
},
],
},
// Configure serverless functions for better Edge Runtime compatibility
serverExternalPackages: ['@supabase/supabase-js'],
// Configure output for Netlify deployment
// Remove standalone for better Netlify compatibility
// output: 'standalone',
// Configurações experimentais para performance e Edge Runtime
experimental: {
// optimizeCss disabled to fix MIME type errors in production (Next.js 16)
optimizeCss: false,
middlewarePrefetch: 'strict',
// Otimização crítica para Netlify - reduzir bundle size
optimizePackageImports: [
'@radix-ui/react-icons',
'lucide-react',
'@radix-ui/react-dialog',
'@radix-ui/react-select',
'@radix-ui/react-separator',
'@radix-ui/react-switch',
'react-hook-form',
'@hookform/resolvers',
'recharts', // Otimizar charts pesados
'react-icons' // Tree shake react-icons
]
},
// Configurações de compiler para performance
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
// Ensure CSS is properly handled
assetPrefix: process.env.NODE_ENV === 'production' ? '' : '',
// Configurações de webpack para otimização
webpack: (config, { isServer, dev }) => {
// Basic alias configuration
config.resolve.alias = {
...config.resolve.alias,
'@': '.',
'@/components': './components',
'@/lib': './lib',
'@/types': './types',
'@/hooks': './hooks',
'@/app': './app'
}
// Basic fallback configuration
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
crypto: false,
}
}
// Ensure date-fns is properly resolved
if (!config.resolve.alias) {
config.resolve.alias = {}
}
// Suppress warnings
config.ignoreWarnings = [
/Failed to parse source map/,
/Critical dependency: the request of a dependency is an expression/,
/A Node\.js API is used \(process\.version at line: \d+\) which is not supported in the Edge Runtime/,
/process\.version/,
/self is not defined/,
/window is not defined/,
/document is not defined/
]
return config
},
}
module.exports = withBundleAnalyzer(nextConfig)