diff --git a/apps/web/next-env.d.ts b/apps/web/next-env.d.ts index dd052b5..830fb59 100644 --- a/apps/web/next-env.d.ts +++ b/apps/web/next-env.d.ts @@ -1,6 +1,6 @@ /// /// -/// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 304596d..0c8a348 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -5,21 +5,24 @@ import { resolve } from 'node:path'; // up. Deliberately not import.meta.url: this package is CommonJS. const repoRoot = resolve(process.cwd(), '..', '..'); +const remotePatterns: any[] = []; +if (process.env.NEXT_PUBLIC_S3_ORIGIN) { + try { + const url = new URL(process.env.NEXT_PUBLIC_S3_ORIGIN); + remotePatterns.push({ protocol: url.protocol.replace(':', ''), hostname: url.hostname, port: url.port || '' }); + } catch {} +} + const config: NextConfig = { - // `next dev` and `next build` must not write into the same directory. Running - // them concurrently otherwise leaves the dev runtime pointing at production - // chunks that have already been replaced (MODULE_NOT_FOUND for numbered or - // vendor chunks). distDir: process.env.NEXT_DIST_DIR ?? '.next', - - // Copies only the files actually imported next to a server.js instead of - // shipping all of node_modules: ~1GB production image down to a few hundred MB. output: 'standalone', - - // npm workspaces hoists most dependencies to the repo-root node_modules, not - // apps/web/node_modules. Without this, tracing starts at apps/web, misses the - // hoisted packages, and the container dies at runtime with MODULE_NOT_FOUND. outputFileTracingRoot: repoRoot, + images: { + remotePatterns: remotePatterns.length > 0 ? remotePatterns : [ + { protocol: 'http', hostname: 'localhost' }, + { protocol: 'https', hostname: 'lh3.googleusercontent.com' } // Google Auth avatars + ], + }, }; export default config;