vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.09k stars 27k forks source link

Docs: CI Build Caching article may need an update for App Router #63711

Open mobob opened 7 months ago

mobob commented 7 months ago

What is the improvement or update you wish to see?

WIth App Router, when running a build in a CI environment, it points at this article;

https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching

Implementing the changes as prescribed does not make the warning go away (at least for me ;))

Is there any context that might help us understand?

I happen to be using AWS CodeBuild which might be relevant. But the pointing to a pages router file doesn't inspire confidence that the instructions still apply.

Happy to make these changes given any minor bit of info that could nudge my knowledge!

A bit more info - from my logs, at the top is the absorption of the settings, then later Next still complaining it has no cache, and points to the above article:

[Container] 2024/03/26 11:15:56.224843 Expanded cache path node_modules/**/*
[Container] 2024/03/26 11:15:56.226511 Expanded cache path .next/cache/**/*

...

frontend build: ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache

Hence my assumption is the deeper linked doc is out of date for App Router. Might be a bad assumption!

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching

mobob commented 4 months ago

I've mostly figured this out now, and its actually still accurate still, however it would be greatly improved by suggested that caching also needs to be enabled in CodeBuild. ie:

Add (or merge in) the following to your buildspec.yml: -> Ensure caching (either S3 or local) is enabled for your CodeBuild project, and then add (or merge in) the following to your buildspec.yml: