Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: move cache assets instead of copying them #883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

makepanic
Copy link

@makepanic makepanic commented May 28, 2025

fixes parts of #822

I'm not sure if this is the right approach though, as it mutates the .next directory by moving files from there directly to the .open-next dir.

From a application with tons of static cache files i get the following difference:

  • current version:
    • .next: 2.8 GiB (2,981,986,740 bytes)
    • .open-next: 1.7 GiB (1,876,966,777 bytes)
  • with this change
    • .next: 1.6 GiB (1,687,644,131 bytes)
    • .open-next: 1.7 GiB (1,869,770,983 bytes)

But seeing that the .open-next dir is a bit smaller something might've broken. Running the app with open-next locally worked just fine though

Copy link

changeset-bot bot commented May 28, 2025

⚠️ No Changeset found

Latest commit: e8b821a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, but i don't think that's what we want to do.
We rely on a bunch of things from the .next folder itself and moving things from there will lead to something that break.
And this will also break some people's deployment, not something we'd want either.

What we should do here instead of copying the file, is to just use the files from .next to compute the cache files instead of copying them. This won't reduce the final size that much, but it will reduce the size used during the deployment itself.

@makepanic
Copy link
Author

Thanks for the PR, but i don't think that's what we want to do. We rely on a bunch of things from the .next folder itself and moving things from there will lead to something that break. And this will also break some people's deployment, not something we'd want either.

What we should do here instead of copying the file, is to just use the files from .next to compute the cache files instead of copying them. This won't reduce the final size that much, but it will reduce the size used during the deployment itself.

Thanks that makes much more sense. I've attempted to refactor it so it's not copying the output and just works on the next output instead.
I've used it inside my next app and it seems to work just fine. Issue is I can't really compare the output with/without this patch as the next asset generation doesn't seem to be deterministic and size varies by a couple kb every build.
The metaFiles size stays the same tho.

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