NX Repo with NextJS 13 App is failing without any error

I have a monorepo in which I have the todoApp which works totally fine on my locally even with the same node/npm version and somehow fails on Cloudflare Pages build. It fails to build dependency package

2023-09-22T20:31:08.626148Z	Executing user command: npm run build:todoApplication:verbose
2023-09-22T20:31:09.349914Z	
2023-09-22T20:31:09.350239Z	> @monorepo/[email protected] build:todoApplication:verbose
2023-09-22T20:31:09.350414Z	> npx nx run todoApplication:build:production --verbose --skip-nx-cache && npx nx run todoApplication:export:production --verbose --skip-nx-cache
2023-09-22T20:31:09.350541Z	
2023-09-22T20:31:11.329979Z	
2023-09-22T20:31:11.330496Z	 >  NX   Running target build for project todoApplication and 1 task it depends on:
2023-09-22T20:31:11.330696Z	
2023-09-22T20:31:11.331118Z	 
2023-09-22T20:31:47.437449Z	
2023-09-22T20:31:47.438414Z	> nx run package1:build
2023-09-22T20:31:47.438862Z	
2023-09-22T20:31:47.439029Z	Bundling package1...
2023-09-22T20:31:47.439368Z	Module level directives cause errors when bundled, 'use client' was ignored.
2023-09-22T20:31:47.451061Z	
2023-09-22T20:31:47.451376Z	 
2023-09-22T20:31:47.451524Z	
2023-09-22T20:31:47.451671Z	 >  NX   Running target build for project todoApplication and 1 task it depends on failed
2023-09-22T20:31:47.45183Z	
2023-09-22T20:31:47.451954Z	   Failed tasks:
2023-09-22T20:31:47.452072Z	   
2023-09-22T20:31:47.452194Z	   - package1:build
2023-09-22T20:31:47.452308Z	   
2023-09-22T20:31:47.452426Z	   Hint: run the command with --verbose for more details.
2023-09-22T20:31:47.452538Z	
2023-09-22T20:31:47.487677Z	Failed: build command exited with code: 1
2023-09-22T20:31:48.260396Z	Failed: error occurred while running build command