With both routers, dev only scans `app/` for client dependencies

Open Beginner friendly
#4,592 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
67/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
next.js, typescript, vite

Research direction

Find where the client’s optimizeDeps.entries is configured and how it selects app/ versus pages/. Check the existing tests for dependency scanning and add coverage for projects containing both routers, including excluding _document. Done means Pages Router only dependencies are discovered before serving pages without triggering re-bundles or reloads.

Written by the indexing model from the issue text.

Description

When app/ exists, the client's optimizeDeps.entries is app/**/*.{tsx,ts,jsx,js}; pages/ is only scanned when there's no app/. In an app migrating between routers, every dependency that only Pages Router pages or _app import gets discovered while serving a page, so Vite re-bundles and reloads. A cold walk of 24 of our pages re-bundled 8 times and reloaded 7, cutting off 5 page loads. Adding pages/** (minus _document) to the entries got rid of every reload.

Dominant language
TypeScript
Stars
9.3k
Forks
463
Avg merge
22h 22m
Merged PRs (30d)
502

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/vinext

All issues in cloudflare/vinext

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.