main
This commit is contained in:
51
next.config.mjs
Normal file
51
next.config.mjs
Normal file
@@ -0,0 +1,51 @@
|
||||
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,
|
||||
},
|
||||
}
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user