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:
+4
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user