-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.js
More file actions
91 lines (78 loc) · 2.68 KB
/
next.config.js
File metadata and controls
91 lines (78 loc) · 2.68 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
/**
* @type {import('next').NextConfig}
*/
// Detectar se estamos usando Turbopack
const isTurbopack = process.argv.includes('--turbo');
const nextConfig = {
env: {
sanityPreview: process.env.SANITY_PREVIEW || 'false',
NEXT_PUBLIC_SANITY_PROJECT_ID: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID,
NEXT_PUBLIC_SANITY_DATASET: process.env.NEXT_PUBLIC_SANITY_DATASET || 'production',
NEXT_PUBLIC_SANITY_API_VERSION: process.env.NEXT_PUBLIC_SANITY_API_VERSION || '2023-05-03'
},
trailingSlash: true,
reactStrictMode: true,
// Otimizações para desenvolvimento
swcMinify: true,
modularizeImports: {
'@sanity/ui': {
transform: '@sanity/ui/{{member}}',
},
'lucide-react': {
transform: 'lucide-react/dist/esm/icons/{{member}}',
},
},
// Configuração de imagens para o Sanity
images: {
domains: ['cdn.sanity.io'],
},
// Configuração experimental para Turbopack
experimental: isTurbopack ? {
turbo: {
resolveAlias: {
'@sanity/visual-editing-csm': false,
'@sanity/visual-editing': false
}
}
} : {},
// Resolver problemas de compatibilidade com @sanity/visual-editing
// Apenas aplicar configurações do webpack se NÃO estivermos usando Turbopack
webpack: isTurbopack ? undefined : (config, { isServer }) => {
config.resolve.alias = {
...config.resolve.alias,
'@sanity/visual-editing-csm': false,
'@sanity/visual-editing': false
};
// Aumentar timeout para chunks grandes
config.output = {
...config.output,
webassemblyModuleFilename: 'static/wasm/[modulehash].wasm',
publicPath: '/_next/',
};
// Otimizar chunking para o Sanity Studio
if (!isServer) {
config.optimization = {
...config.optimization,
splitChunks: {
chunks: 'all',
cacheGroups: {
sanity: {
test: /[\\/]node_modules[\\/](@sanity|sanity)[\\/]/,
name: 'sanity',
priority: 10,
reuseExistingChunk: true
}
}
}
};
}
return config;
},
// Ignorar erros de tipos durante o build (temporário)
typescript: {
ignoreBuildErrors: true,
},
// Output standalone para melhor compatibilidade com Netlify
output: 'standalone'
};
module.exports = nextConfig;