fix(frontend): disable standalone + webpackMemoryOptimizations in dev

next dev mode was throwing ENOENT for routes-manifest.json and other
chunk files, leaving /login and other routes permanently 404 after
the first compile. Root cause:

- output: "standalone" is a prod build option; combined with next dev
  it produces chunk paths and manifests that don't match what dev
  expects.
- experimental.webpackMemoryOptimizations evicts compiled modules to
  save memory, but in dev that includes already-served SSR chunks,
  so requests after the eviction window 404 even though the page
  compiled successfully.

Wrap both options in an isDev check so prod build behavior is
preserved while dev no longer self-destructs its own chunks.
Verified on the office Ubuntu invyone-frontend container: /, /login
return 200 and the chunk-loss errors are gone.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 23:32:31 +09:00
parent 5bcff2db4d
commit 00dd9e3a59
+7 -5
View File
@@ -1,10 +1,12 @@
/** @type {import('next').NextConfig} */
const isDev = process.env.NODE_ENV !== "production";
const nextConfig = {
// Leaflet 등 DOM 직접 조작 라이브러리와 Strict Mode 충돌 방지
reactStrictMode: false,
// Docker 빌드 최적화
output: "standalone",
// Docker 빌드 최적화 (prod build 전용 — dev에서 켜면 청크 경로/매니페스트가 깨져 ChunkLoadError 발생)
...(isDev ? {} : { output: "standalone" }),
// ESLint 빌드 시 무시 (프로덕션 빌드 성공을 위해)
eslint: {
@@ -16,9 +18,9 @@ const nextConfig = {
ignoreBuildErrors: true,
},
// 실험적 기능 활성화
experimental: {
// 메모리 사용량 최적화 (Next.js 15+)
// 실험적 기능: dev에서는 webpackMemoryOptimizations 비활성화
// (Next 15에서 dev 중 컴파일된 청크가 evict되어 404 나는 이슈)
experimental: isDev ? {} : {
webpackMemoryOptimizations: true,
},