javascriptreactjstypescriptnext.js

Next.js 14.1 Dev Mode compilation extremely slow


I've recently upgraded my Next.js project to version 14.1, excited about the new features and improvements. However, I've noticed a significant slowdown in compilation times while running the project in development mode (next dev). It's taking noticeably longer than before, which impacts my workflow productivity.

What could be the reason for this issue with Next.js 14.1 in development mode? Are there any known fixes or optimizations that can help speed up the compilation process?

Here are a few details about my setup:

Next.js version: 14.1
Node.js version: node-v20.11.0-x64
Operating system: Win 10

I've tried some basic troubleshooting steps like clearing caches and ensuring my dependencies are up to date, but the issue persists.


Solution

  • I also had this issue for a while. You can try adding a new script in the package.json like this:

    "scripts": {
        "dev": "next dev",
        "fast": "next dev --turbo",
        "build": "next build",
        "start": "next start",
        "lint": "next lint",
        "postinstall": "prisma generate"
    },
    

    then use this command:

    npm run fast
    

    It is in beta (experimental) mode but it is much faster. Here's the official documentation link.