Skip to content

Next.js Application Does Not build When Upgrading to Next.js v16.3.2 #36757

Description

@jtw-r

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

  1. Clone the https://github.com/nrwl/nextjs-template repo
  2. Update Next.js dependency in the apps/web/package.json file from ~16.2.10 to 16.3.2
  3. 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

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions