[PR #27014] build: bump NextJS from 15 to 16 with turbopack enabled for web production build boost #31636

Closed
opened 2026-02-21 20:49:50 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/27014

State: closed
Merged: Yes


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

  • to close #27013

  • 3x faster improvement in web production build performance with Turbopack enabled, which has been stable for production build

    • (before) Next.js 15.5.4 without Turbopack: 73 sec
    • (after) Next.js 16.1.4 with Turbopack enabled: 17sec (cold run)
    • 4.39x faster in production build time
  • changes applied

    • changes from codemod run:
      • bumped React from 19.1 to 19.2
      • renamed middleware.js to proxy.ts
    • manual changes:
  • Result: The end-to-end build time for production is now 3x faster

    • build machine: MacBook Pro 2024 with M4 Max chip
    • 15.5.9 (without turbopack ): 73s
Wed Jan 21 11:25:49 CST 2026

> dify-web@1.11.4 build /Users/bw/dev/dify/web
> next build

   ▲ Next.js 15.5.9

   Creating an optimized production build ...
 ✓ Compiled successfully in 55s
   Skipping validation of types
   Skipping linting
 ✓ Collecting page data    
 ⚠ (serwist) 1241 precache entries (39629.00 KiB)
⚠ warnings
  public/vs/language/typescript/tsWorker.js is 5.75 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.
  public/vs/editor/editor.main.js is 3.77 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.

 ✓ Generating static pages (36/36)
 ✓ Collecting build traces    
 ✓ Finalizing page optimization    

...

ƒ Middleware                                               34.1 kB

●  (SSG)      prerendered as static HTML (uses generateStaticParams)
ƒ  (Dynamic)  server-rendered on demand

Wed Jan 21 11:27:04 CST 2026
  • 16.1.4 (with turbopack enabled ): 17s
Wed Jan 21 12:06:15 CST 2026

> dify-web@1.11.4 build /Users/bw/dev/dify/web
> next build

▲ Next.js 16.1.4 (Turbopack)

  Creating an optimized production build ...
✓ Compiled successfully in 13.4s
  Skipping validation of types
✓ Collecting page data using 15 workers in 815.2ms    
⚠ (serwist) 1414 precache entries (56475.62 KiB)
⚠ warnings
  public/vs/language/typescript/tsWorker.js is 5.75 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.                                                                          
  public/vs/editor/editor.main.js is 3.77 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit.                                                                                    
                                                                                                                                                                                                                       
✓ Generating static pages using 15 workers (35/35) in 876.4ms
✓ Finalizing page optimization in 317.5ms    

...


ƒ Proxy (Middleware)

●  (SSG)      prerendered as static HTML (uses generateStaticParams)
ƒ  (Dynamic)  server-rendered on demand

Wed Jan 21 12:06:32 CST 2026

Screenshots

Production build time on M4 Max chip:

Before After
15.5.9 (without turbopack ): 573s 16.1.4 (with turbopack enabled ): 17s

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/27014 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> - to close #27013 - 3x faster improvement in web production build performance with Turbopack enabled, which has been [stable for production build](https://nextjs.org/blog/next-16) - (before) Next.js 15.5.4 without Turbopack: 73 sec - (after) Next.js 16.1.4 with Turbopack enabled: 17sec (cold run) - 4.39x faster in production build time - changes applied - changes from codemod run: - bumped React from 19.1 to 19.2 - renamed middleware.js to proxy.ts - manual changes: - enable [Turbopack File System Caching](https://nextjs.org/blog/next-16#turbopack-file-system-caching-beta) for development - Result: The end-to-end build time for production is now 3x faster - build machine: MacBook Pro 2024 with M4 Max chip - 15.5.9 (without turbopack ): 73s ``` Wed Jan 21 11:25:49 CST 2026 > dify-web@1.11.4 build /Users/bw/dev/dify/web > next build ▲ Next.js 15.5.9 Creating an optimized production build ... ✓ Compiled successfully in 55s Skipping validation of types Skipping linting ✓ Collecting page data ⚠ (serwist) 1241 precache entries (39629.00 KiB) ⚠ warnings public/vs/language/typescript/tsWorker.js is 5.75 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit. public/vs/editor/editor.main.js is 3.77 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit. ✓ Generating static pages (36/36) ✓ Collecting build traces ✓ Finalizing page optimization ... ƒ Middleware 34.1 kB ● (SSG) prerendered as static HTML (uses generateStaticParams) ƒ (Dynamic) server-rendered on demand Wed Jan 21 11:27:04 CST 2026 ``` - 16.1.4 (with turbopack enabled ): 17s ``` Wed Jan 21 12:06:15 CST 2026 > dify-web@1.11.4 build /Users/bw/dev/dify/web > next build ▲ Next.js 16.1.4 (Turbopack) Creating an optimized production build ... ✓ Compiled successfully in 13.4s Skipping validation of types ✓ Collecting page data using 15 workers in 815.2ms ⚠ (serwist) 1414 precache entries (56475.62 KiB) ⚠ warnings public/vs/language/typescript/tsWorker.js is 5.75 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit. public/vs/editor/editor.main.js is 3.77 MB, and won't be precached. Configure maximumFileSizeToCacheInBytes to change this limit. ✓ Generating static pages using 15 workers (35/35) in 876.4ms ✓ Finalizing page optimization in 317.5ms ... ƒ Proxy (Middleware) ● (SSG) prerendered as static HTML (uses generateStaticParams) ƒ (Dynamic) server-rendered on demand Wed Jan 21 12:06:32 CST 2026 ``` ## Screenshots Production build time on M4 Max chip: | Before | After | |--------|-------| | 15.5.9 (without turbopack ): 573s | 16.1.4 (with turbopack enabled ): 17s | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:49:50 -05:00
yindo closed this issue 2026-02-21 20:49:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#31636