I just added "NODE_ENV=production" to my build script and it works fine for me "build": "NODE_ENV=production next build",