From 57574cf787bb4e3230bf03e29f2dcf74b14dcd7d Mon Sep 17 00:00:00 2001 From: shin4488 <37034832+shin4488@users.noreply.github.com> Date: Sun, 4 Oct 2026 16:07:25 +0900 Subject: [PATCH] fix: let Parcel pick NODE_ENV so container builds match production docker-compose.yml set NODE_ENV=development for the whole app service, so every command run with `docker compose exec` inherited it. Parcel keeps an existing NODE_ENV, which made `yarn build` in the container bundle the development builds of React: the JS came out at ~611 kB instead of the ~443 kB Render serves. Parcel already defaults NODE_ENV to development for the dev server and to production for `parcel build`, and enables HMR for the dev server regardless of NODE_ENV. Vitest likewise defaults it to test, as in CI. Stop setting it in compose and keep the PARCEL_WATCH_INTERVAL hint as a commented-out environment block, since compose rejects an empty one. Co-Authored-By: Claude Opus 5.5 --- docker-compose.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cad729d..51061f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,10 +18,11 @@ services: fi echo "[compose] starting dev server..." exec yarn dev --host 0.0.0.0 --port 1234 - environment: - - NODE_ENV=development - # Docker Desktop などでファイル監視が不安定な場合はコメントアウトを外す - # - PARCEL_WATCH_INTERVAL=100 + # NODE_ENV は設定せず、Parcel の既定(dev サーバーは development、build は production)に任せる + # ここで固定すると exec で実行する yarn build にも効き、本番と異なる開発版の React が同梱される + # Docker Desktop などでファイル監視が不安定な場合は次の 2 行のコメントアウトを外す + # environment: + # - PARCEL_WATCH_INTERVAL=100 ports: - 1234:1234 # ホットリロード前提のマウント設定