I have a new NX monorepo with 3 apps. Two of them are bundled with Vite and one is a NextJS project.
When I deploy the vite app to AWS Amplify it recognizes the app folder as NextJS-SSR! It also throws the error
CustomerError: Can't find required-server-files.json in build output directory
Vite | amplify.yml
version: 1
applications:
- frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npx nx build vite-app
artifacts:
baseDirectory: dist/apps/vite-app
files:
- '**/*'
cache:
paths:
- node_modules/**/*
buildPath: /
appRoot: apps/vite-app
Note
If I remove the NextJS app using nx remove nextjs-app and deploy to AWS Amplify with just the vite apps. The app deploys correctly.
I don't understand why Amplify is recognizing the app as NextJS and how to get rid off it. I need to deploy two applications with vite and two with nextjs.
P.S: I can provide more info if needed!
Edit
NextJS | amplify.yml
version: 1
applications:
- frontend:
phases:
preBuild:
commands:
- node -v
- npm ci
build:
commands:
- npx nx build nextjs-app
artifacts:
baseDirectory: dist/apps/nextjs-app
files:
- '**/*'
cache:
paths:
- .next/cache/**/*
- node_modules/**/*
buildPath: /
appRoot: apps/nextjs-app
The Nextjs project is deployed successfully without any issues.