Currently, as I work on building my project on Amplify hosting, I have encountered a front-end build issue. The technology stack I am using is Next.js.
Error:
./src/pages/_app.js
Module not found: Can't resolve '../aws-exports' in '/codebuild/output/src195962774/src/PROJECTNAME/src/pages'
amplify.yml file:
version: 1
frontend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- npm run build
backend:
phases:
preBuild:
commands:
- npm install
artifacts:
baseDirectory: .next
files:
- '**/*'
I have experimented with various configurations in this build file and have even tackled the initial issue with graphql-ttl-transformer.
To troubleshoot, I attempted duplicating a file in the pages folder and retrying the process. Working in VsCode, the file-path of "../aws-exports"
was auto-populated, ensuring its correctness.