I figure this out myself. I change the amplify build setting to the following
version: 1
applications:
-
backend:
phases:
build:
commands: ['npm ci --cache .npm --prefer-offline', 'npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID']
frontend:
phases:
build:
commands: ['mkdir ./dist && touch ./dist/index.html']
artifacts:
baseDirectory: dist
files:
- '**/*'
cache:
paths:
- '.npm/**/*'
appRoot: packages/shared_backend