65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
let userConfig = undefined
|
|
try {
|
|
// try to import ESM first
|
|
userConfig = await import('./v0-user-next.config.mjs')
|
|
} catch (e) {
|
|
try {
|
|
// fallback to CJS import
|
|
userConfig = await import("./v0-user-next.config");
|
|
} catch (innerError) {
|
|
// ignore error
|
|
}
|
|
}
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
eslint: {
|
|
ignoreDuringBuilds: true,
|
|
},
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
images: {
|
|
unoptimized: true,
|
|
},
|
|
experimental: {
|
|
webpackBuildWorker: true,
|
|
parallelServerBuildTraces: true,
|
|
parallelServerCompiles: true,
|
|
},
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/api/:path*',
|
|
headers: [
|
|
{ key: 'Access-Control-Allow-Credentials', value: 'true' },
|
|
{ key: 'Access-Control-Allow-Origin', value: '*' },
|
|
{ key: 'Access-Control-Allow-Methods', value: 'GET,DELETE,PATCH,POST,PUT,OPTIONS' },
|
|
{ key: 'Access-Control-Allow-Headers', value: 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, Authorization' },
|
|
],
|
|
},
|
|
]
|
|
},
|
|
}
|
|
|
|
if (userConfig) {
|
|
// ESM imports will have a "default" property
|
|
const config = userConfig.default || userConfig
|
|
|
|
for (const key in config) {
|
|
if (
|
|
typeof nextConfig[key] === 'object' &&
|
|
!Array.isArray(nextConfig[key])
|
|
) {
|
|
nextConfig[key] = {
|
|
...nextConfig[key],
|
|
...config[key],
|
|
}
|
|
} else {
|
|
nextConfig[key] = config[key]
|
|
}
|
|
}
|
|
}
|
|
|
|
export default nextConfig
|