we have a next.js project which works correctly.
We developed also a ReactNative GUI for the service.
In order to keep Clients (Web and RN) aligned and in the codebase we added “app” folder in the Next.js project to keep the whole ReactNative Project.
Until we worked on dev env no issue so far.
As soon as we moved to production, running the next build we got the following error:
NODE_ENV=production next build
▲ Next.js 14.2.4
- Environments: .env
Creating an optimized production build …
⨯ node_modules/css-tree/lib/syntax/atrule/page.js doesn’t have a root layout. To fix this error, make sure every page has a root layout.
The folder css-tree is a node_module dependency in ReactNative folder… so not relevant at all to next.js.
As the whole React Native project is rooted in a subfolder how to configure next.js to skip such subfolder. I see there are options to exclude from ts type-checking but how to exclude subdir scans for page.js ?
Note: I tried to configure pageExtensions in next.config.js to skip the page.js
pageExtensions: [ ‘fakepage.js’],
this way I don’t get the error but the main app index is not built at all.
Project Tree is as follows:
│ ├── ...
│ ├──node_modules/css-tree/lib/syntax/atrule/page.js
│ └── ...
├── config
├── design
├── dotenv
├── images
├── jsconfig.json
├── logs
├── next.config.js
├── next-env.d.ts
├── node_modules
├── package.json
├── package-lock.json
├── postcss.config.js
├── public
├── scripts
├── server
├── src
└── tsconfig.json```