Spaces:
Build error
Build error
| 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, | |
| }, | |
| output: 'standalone', | |
| experimental: { | |
| webpackBuildWorker: true, | |
| parallelServerBuildTraces: true, | |
| parallelServerCompiles: true, | |
| }, | |
| async rewrites() { | |
| return [ | |
| { | |
| source: '/api/:path*', | |
| destination: '/api/:path*', | |
| }, | |
| ] | |
| }, | |
| // Detect if we're in a Hugging Face Space and configure accordingly | |
| ...(process.env.SPACE_ID ? { | |
| // No basePath needed for HF Spaces as they use the root path | |
| assetPrefix: process.env.NEXT_PUBLIC_SITE_URL || '' | |
| } : {}) | |
| } | |
| 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 | |