(nextConfig, userConfig)
| 23 | mergeConfig(nextConfig, userConfig) |
| 24 | |
| 25 | function mergeConfig(nextConfig, userConfig) { |
| 26 | if (!userConfig) { |
| 27 | return |
| 28 | } |
| 29 | |
| 30 | for (const key in userConfig) { |
| 31 | if ( |
| 32 | typeof nextConfig[key] === 'object' && |
| 33 | !Array.isArray(nextConfig[key]) |
| 34 | ) { |
| 35 | nextConfig[key] = { |
| 36 | ...nextConfig[key], |
| 37 | ...userConfig[key], |
| 38 | } |
| 39 | } else { |
| 40 | nextConfig[key] = userConfig[key] |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | export default nextConfig |