From e90d0075132245619b6e93d1d4d3173cb312a1d3 Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Tue, 19 May 2026 17:13:13 -0700 Subject: [PATCH] Amplify: install devDependencies during build (Tailwind/PostCSS need them) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @tailwindcss/postcss lives in devDependencies (along with the rest of the PostCSS toolchain). When NODE_ENV=production is set in the Amplify build environment, npm ci skips devDependencies — and next build then fails resolving @tailwindcss/postcss while compiling globals.css. amplify.yml now passes --include=dev to npm ci so the build always installs everything regardless of NODE_ENV. AMPLIFY_DEPLOY.md updated to warn against setting NODE_ENV=production in the Amplify env vars panel — it's redundant (Next sets it correctly) and an easy footgun. --- AMPLIFY_DEPLOY.md | 7 ++++++- amplify.yml | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/AMPLIFY_DEPLOY.md b/AMPLIFY_DEPLOY.md index 11f6df5..db2f48c 100644 --- a/AMPLIFY_DEPLOY.md +++ b/AMPLIFY_DEPLOY.md @@ -41,7 +41,12 @@ On the environment-variables screen, add the following. Required ones first: | `CIVI_BASE_URL` | e.g. `https://crm.fci.coop` | | `CIVI_API_KEY` | mark as **Secret** (eye icon on the value field) | | `CIVI_SITE_KEY` | mark as **Secret** | -| `NODE_ENV` | `production` | + +Do **not** set `NODE_ENV=production` in the Amplify panel. Amplify and Next +already set it correctly at runtime; setting it at build time causes +`npm ci` to skip devDependencies, which breaks the Tailwind/PostCSS step. +The `amplify.yml` in this repo guards against this with `--include=dev`, +but it's cleaner not to set it at all. Optional, only if relevant: diff --git a/amplify.yml b/amplify.yml index 1615c3d..fee4650 100644 --- a/amplify.yml +++ b/amplify.yml @@ -5,7 +5,10 @@ applications: preBuild: commands: - nvm use $(cat .nvmrc) || nvm install $(cat .nvmrc) - - npm ci --cache .npm --prefer-offline + # --include=dev is required because the build needs PostCSS / + # Tailwind plugins which live in devDependencies; without it, + # NODE_ENV=production in the Amplify env causes npm to skip them. + - npm ci --include=dev --cache .npm --prefer-offline build: commands: - npm run build