CI builds took 14 minutes — bloated default deps + an uncommitted lockfile. Root cause: Unpinned deps re-resolved every build; unused packages bloated install. The fix: Commit the lockfile, use `npm ci`, prune unused default deps.
A production war story from the TheCodeForge Next.js series — the incident, why it happened, and the exact fix.
⏳ Timestamps:
0:00 - Cold open: CI builds took 14+ minutes; 11 minutes of that was npm install.
0:13 - Version Compatibility: Next.js 16 Requires Node.js 18+
0:49 - Production Caveat: Lockfile Integrity
1:03 - Intro
1:13 - What Is Next.js?
1:35 - What create-next-app Does
1:59 - Dependency Tree Explained
2:33 - Project Structure
2:53 - Root Layout Required
3:23 - Build Pipeline Options
4:03 - The 12 Starter Files
4:36 - package.json Dependencies
5:02 - Hidden Cost of TypeScript
5:37 - Lockfile Importance
6:10 - Dev Server Behavior
6:40 - Production Build Output
7:10 - Environment Variables
7:39 - Public Folder Usage
8:11 - Config Files Overview
8:43 - First Page: Server Component
9:17 - What You Can Safely Delete
9:50 - Before You Deploy
10:17 - CI builds took 14+ minutes; 11 minutes of that was npm install.
10:45 - Unused devDependencies bloated install
11:05 - The Fix: Audit & Trim
11:26 - ⚠ Gotcha: Putting secrets in NEXT_PUBLIC_ vars
11:41 - ⚠ Gotcha: Not configuring images.remotePatterns
11:56 - ⚠ Gotcha: Deleting root layout.js causes 404
12:11 - Debugging Guide
12:24 - Interview Questions
12:54 - FAQ
13:17 - Key Takeaways
13:37 - Next up
14:01 - Wrap-up
👉 Full article + code: https://thecodeforge.io/javascript/ne...
⏭ Next up: Pages and Layouts in Next.js: File-Based Routing Explained
#nextjs #javascript