Current Behavior
I cloned the nrwl/nextjs-template repo and upgraded Next.js to v16.3.2 (latest version as of writing this), because I was experiencing some build issues in my large work monorepo.
When running npx nx build @nextjs-template/web after upgrading Next.js, the process fails with a typescript error (TS6305). This did not happen on Next.js version ~16.2.11
NX Running target build for project @nextjs-template/web
✖ nx run @nextjs-template/web:build
> next build
▲ Next.js 16.3.2 (Turbopack)
✓ Running next.config.js took 8ms
Creating an optimized production build ...
✓ Compiled successfully in 1384ms
src/app/page.tsx:1:41 - error TS6305: Output file '/Users/work/coding-repos/nx-nextjs-template/packages/ui/dist/index.d.ts' has not been built from source file '/Users/work/coding-repos/nx-nextjs-template/packages/ui/src/index.ts'.
1 import { HeroBanner, FeatureCard } from '@nextjs-template/ui';
~~~~~~~~~~~~~~~~~~~~~
Found 1 error in src/app/page.tsx:1
Failed to type check.
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target build for project @nextjs-template/web (3s)
✔ 0/1 succeeded [0 read from cache]
✖ 1/1 targets failed, including the following:
- nx run @nextjs-template/web:build
Run duration: 3.2s
Critical path: 3.1s (1 task)
Recoverable time: <1ms
Expected Behavior
Project should build
GitHub Repo
https://github.com/nrwl/nextjs-template
Steps to Reproduce
- Clone the
https://github.com/nrwl/nextjs-template repo
- Update Next.js dependency in the
apps/web/package.json file from ~16.2.10 to 16.3.2
- Run
npx nx build @nextjs-template/web
Nx Report
Node : 22.22.3
OS : darwin-arm64
Native Target : aarch64-macos
npm : 10.9.8
daemon : Available
nx : 23.1.1
@nx/js : 23.1.1
@nx/eslint : 23.1.1
@nx/workspace : 23.1.1
@nx/jest : 23.1.1
@nx/devkit : 23.1.1
@nx/eslint-plugin : 23.1.1
@nx/module-federation : 23.1.1
@nx/next : 23.1.1
@nx/playwright : 23.1.1
@nx/react : 23.1.1
@nx/rollup : 23.1.1
@nx/vite : 23.1.1
@nx/vitest : 23.1.1
typescript : 6.0.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/next/plugin
@nx/eslint/plugin
@nx/playwright/plugin
@nx/jest/plugin
---------------------------------------
Cache Usage: 0.00 B / 372.19 GB
Failure Logs
NX Running target build for project @nextjs-template/web
✖ nx run @nextjs-template/web:build
> next build
▲ Next.js 16.3.2 (Turbopack)
✓ Running next.config.js took 8ms
Creating an optimized production build ...
✓ Compiled successfully in 1384ms
src/app/page.tsx:1:41 - error TS6305: Output file '/Users/work/coding-repos/nx-nextjs-template/packages/ui/dist/index.d.ts' has not been built from source file '/Users/work/coding-repos/nx-nextjs-template/packages/ui/src/index.ts'.
1 import { HeroBanner, FeatureCard } from '@nextjs-template/ui';
~~~~~~~~~~~~~~~~~~~~~
Found 1 error in src/app/page.tsx:1
Failed to type check.
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target build for project @nextjs-template/web (3s)
✔ 0/1 succeeded [0 read from cache]
✖ 1/1 targets failed, including the following:
- nx run @nextjs-template/web:build
Run duration: 3.2s
Critical path: 3.1s (1 task)
Recoverable time: <1ms
Package Manager Version
No response
Operating System
Additional Information
No response
Current Behavior
I cloned the nrwl/nextjs-template repo and upgraded Next.js to v16.3.2 (latest version as of writing this), because I was experiencing some build issues in my large work monorepo.
When running
npx nx build @nextjs-template/webafter upgrading Next.js, the process fails with a typescript error (TS6305). This did not happen on Next.js version ~16.2.11NX Running target build for project @nextjs-template/web ✖ nx run @nextjs-template/web:build > next build ▲ Next.js 16.3.2 (Turbopack) ✓ Running next.config.js took 8ms Creating an optimized production build ... ✓ Compiled successfully in 1384ms src/app/page.tsx:1:41 - error TS6305: Output file '/Users/work/coding-repos/nx-nextjs-template/packages/ui/dist/index.d.ts' has not been built from source file '/Users/work/coding-repos/nx-nextjs-template/packages/ui/src/index.ts'. 1 import { HeroBanner, FeatureCard } from '@nextjs-template/ui'; ~~~~~~~~~~~~~~~~~~~~~ Found 1 error in src/app/page.tsx:1 Failed to type check. ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— NX Ran target build for project @nextjs-template/web (3s) ✔ 0/1 succeeded [0 read from cache] ✖ 1/1 targets failed, including the following: - nx run @nextjs-template/web:build Run duration: 3.2s Critical path: 3.1s (1 task) Recoverable time: <1msExpected Behavior
Project should build
GitHub Repo
https://github.com/nrwl/nextjs-template
Steps to Reproduce
https://github.com/nrwl/nextjs-templaterepoapps/web/package.jsonfile from~16.2.10to16.3.2npx nx build @nextjs-template/webNx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
No response