Skip to content
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

Duplicate Imports from next/cache and build size increase #77823

Open
m-elagamy opened this issue Apr 4, 2025 · 0 comments
Open

Duplicate Imports from next/cache and build size increase #77823

m-elagamy opened this issue Apr 4, 2025 · 0 comments
Labels
Performance Anything with regards to Next.js performance.

Comments

@m-elagamy
Copy link

m-elagamy commented Apr 4, 2025

https://github.com/m-elagamy/nextjs-cache-duplication

To Reproduce

  1. Clone: git clone https://github.com/m-elagamy/nextjs-cache-duplication.git
  2. Install: npm install
  3. Build: npm run build
  4. Observe:
    • Duplicate imports from 'next/cache' (e.g., revalidatePath, revalidateTag) in IDE autocomplete or build output.
    • Size increase (see below).

Current vs. Expected behavior

Actual Behavior

  • All exports from 'next/cache' (e.g., revalidatePath, revalidateTag) are duplicated.
  • Fresh size: 351MB
  • Post-build size: 398MB

Expected Behavior

  • Single import for each export from 'next/cache'.
  • Build output should maintain reasonable size proportional to project complexity (without unexpected duplication of core modules).

Before building

Image

After

Image

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 16295
  Available CPU cores: 4
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: 10.7.0
Relevant Packages:
  next: 15.2.4 // Latest available version is detected (15.2.4).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: N/A
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Performance

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional Context

@github-actions github-actions bot added the Performance Anything with regards to Next.js performance. label Apr 4, 2025
@m-elagamy m-elagamy changed the title Duplicate Imports from 'next/cache' and Build Size Increase Duplicate Imports from next/cache and Build Size Increase Apr 4, 2025
@m-elagamy m-elagamy changed the title Duplicate Imports from next/cache and Build Size Increase Duplicate Imports from next/cache and build size increase Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Anything with regards to Next.js performance.
Projects
None yet
Development

No branches or pull requests

1 participant