My website is built using Nuxt js and hosted on AWS Amplify. I've encountered a major issue where the website still gets generated successfully even when there's a failure in the nuxt generate command (like a JavaScript error in my code). Below is the command I use for building:
version: 1
frontend:
phases:
preBuild:
commands:
- npm install
- echo "API_URL=$API_URL" >> .env
build:
commands:
- npm run generate --fail-on-error
artifacts:
# IMPORTANT - Please verify your build output directory
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- node_modules/**/*
I was under the impression that --fail-on-error would cause the build to fail, but that doesn't seem to be the case based on my observations.