|
| 1 | +import { resolve } from 'path' |
| 2 | + |
| 3 | +const FREEBUFF_PORT = 3002 |
| 4 | + |
| 5 | +/** @type {import('next').NextConfig} */ |
| 6 | +const nextConfig = { |
| 7 | + outputFileTracingRoot: resolve(import.meta.dirname, '../../'), |
| 8 | + env: { |
| 9 | + // In development, override the app URL to point to the Freebuff dev server port. |
| 10 | + // In production, NEXT_PUBLIC_CODEBUFF_APP_URL is set via deployment env vars. |
| 11 | + ...(process.env.NODE_ENV === 'development' |
| 12 | + ? { NEXT_PUBLIC_CODEBUFF_APP_URL: `http://localhost:${FREEBUFF_PORT}` } |
| 13 | + : {}), |
| 14 | + }, |
| 15 | + eslint: { |
| 16 | + ignoreDuringBuilds: true, |
| 17 | + }, |
| 18 | + typescript: { |
| 19 | + ignoreBuildErrors: true, |
| 20 | + }, |
| 21 | + webpack: (config) => { |
| 22 | + config.resolve.fallback = { fs: false, net: false, tls: false, path: false } |
| 23 | + config.externals.push( |
| 24 | + { 'thread-stream': 'commonjs thread-stream', pino: 'commonjs pino' }, |
| 25 | + 'pino-pretty', |
| 26 | + 'encoding', |
| 27 | + 'perf_hooks', |
| 28 | + 'async_hooks', |
| 29 | + ) |
| 30 | + config.externals.push( |
| 31 | + '@codebuff/code-map', |
| 32 | + '@codebuff/code-map/parse', |
| 33 | + '@codebuff/code-map/languages', |
| 34 | + /^@codebuff\/code-map/, |
| 35 | + ) |
| 36 | + config.infrastructureLogging = { |
| 37 | + level: 'error', |
| 38 | + } |
| 39 | + return config |
| 40 | + }, |
| 41 | + headers: () => { |
| 42 | + return [ |
| 43 | + { |
| 44 | + source: '/(.*)', |
| 45 | + headers: [ |
| 46 | + { |
| 47 | + key: 'X-Frame-Options', |
| 48 | + value: 'SAMEORIGIN', |
| 49 | + }, |
| 50 | + ], |
| 51 | + }, |
| 52 | + { |
| 53 | + source: '/api/auth/cli/:path*', |
| 54 | + headers: [ |
| 55 | + { |
| 56 | + key: 'Access-Control-Allow-Origin', |
| 57 | + value: '*', |
| 58 | + }, |
| 59 | + { |
| 60 | + key: 'Access-Control-Allow-Methods', |
| 61 | + value: 'GET, POST, OPTIONS', |
| 62 | + }, |
| 63 | + { |
| 64 | + key: 'Access-Control-Allow-Headers', |
| 65 | + value: 'Content-Type', |
| 66 | + }, |
| 67 | + ], |
| 68 | + }, |
| 69 | + ] |
| 70 | + }, |
| 71 | + reactStrictMode: false, |
| 72 | +} |
| 73 | + |
| 74 | +export default nextConfig |
0 commit comments