forked from SAYANdasAi/Taskflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
83 lines (75 loc) · 1.93 KB
/
next.config.mjs
File metadata and controls
83 lines (75 loc) · 1.93 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
import { promises as fs } from 'fs'
import { fileURLToPath } from 'url'
import path from 'path'
// Get current directory in ES module
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
let userConfig = undefined
try {
userConfig = await import('./v0-user-next.config')
} catch (e) {
// ignore error
}
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
serverActions: {},
webpackBuildWorker: true,
parallelServerBuildTraces: true,
parallelServerCompiles: true,
},
api: {
bodyParser: {
sizeLimit: '10mb',
},
},
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
images: {
unoptimized: true,
},
serverRuntimeConfig: {
PROJECT_ROOT: __dirname,
GOOGLE_APPLICATION_CREDENTIALS_PATH: path.join(__dirname, 'taskflow_keys.json')
},
webpack: (config, { isServer }) => {
if (isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
path: false,
os: false,
stream: false,
crypto: false
}
}
return config
}
}
function mergeConfig(nextConfig, userConfig) {
if (!userConfig) return
for (const key in userConfig) {
if (typeof nextConfig[key] === 'object' && !Array.isArray(nextConfig[key])) {
nextConfig[key] = { ...nextConfig[key], ...userConfig[key] }
} else {
nextConfig[key] = userConfig[key]
}
}
}
mergeConfig(nextConfig, userConfig)
// Verify credentials in production
if (process.env.NODE_ENV === 'production') {
try {
await fs.access(path.join(__dirname, 'taskflow_keys.json'))
console.log('✓ Google Cloud credentials file found')
} catch (error) {
console.error('✗ ERROR: google-credentials.json not found at project root')
console.error('Please ensure the file exists with proper permissions')
process.exit(1)
}
}
export default nextConfig