Skip to content

Add NextJS build cache#8

Open
cskrov wants to merge 1 commit into
mainfrom
add-nextjs-build-cache
Open

Add NextJS build cache#8
cskrov wants to merge 1 commit into
mainfrom
add-nextjs-build-cache

Conversation

@cskrov

@cskrov cskrov commented Mar 20, 2025

Copy link
Copy Markdown
Contributor

The cache spends more time than it saves!

At least for now.

Some numbers from testing

Cache saves 8-10 seconds, depending on the run. Build time typically went from 45 to 36 seconds.
The cache spends around 15-17 seconds (roughly 50-50 restore and save).

Copilot AI review requested due to automatic review settings March 20, 2025 14:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds steps to cache the NextJS build in the deploy workflow to reduce build time.

  • Adds restore and save cache steps for the .next/cache directory.
  • Uses file hashes for ts/tsx files to compute the cache key.
Comments suppressed due to low confidence (1)

.github/workflows/deploy-to-dev.yaml:64

  • The cache key calculation only includes TypeScript files, which may omit other critical files (e.g., next.config.js, package.json) that influence the NextJS build output. Consider including these files in the hashFiles pattern to ensure the cache is invalidated when relevant changes occur.
key: nextjs-${{ hashFiles('**/*.ts', '**/*.tsx') }}

@cskrov cskrov force-pushed the add-nextjs-build-cache branch from 9b768ef to e82d124 Compare August 18, 2025 14:18
@cskrov cskrov force-pushed the add-nextjs-build-cache branch from e82d124 to 92267bf Compare August 29, 2025 14:47
@cskrov cskrov force-pushed the add-nextjs-build-cache branch from 92267bf to 1e18c7b Compare December 2, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants