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