Amplify: install devDependencies during build (Tailwind/PostCSS need them)

@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.
This commit is contained in:
Joel Brock
2026-05-19 17:13:13 -07:00
parent 6e7df382c9
commit e90d007513
2 changed files with 10 additions and 2 deletions
+4 -1
View File
@@ -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