hi-ogawa / vite-plugins

Next.js compatible React Server Component framework on Vite
https://rsc-experiment-hiroshi.vercel.app/test
MIT License
58 stars 3 forks source link

rework browser `optimizeDeps` #562

Closed hi-ogawa closed 3 months ago

hi-ogawa commented 3 months ago

Current heuristics of optimizeDeps.entries: ["routes/**"] turns out to be a bit erroneous since it tries to pre-bundle entire server dependency and causes issues (warning?) for examples

It's not so critical since it shouldn't be that hard to manually identify such "server heavy" deps and configure by themselves, but the error message looks quite shocking at first for new users, so probably need to do something.


Simplest heuristic would be to crawl only local files (e.g. under app/) and find "use client" on our side, then use it as optimizeDeps.entries.

hi-ogawa commented 3 months ago

See https://github.com/hi-ogawa/vite-plugins/pull/560#issuecomment-2228078019 Probably outing-out specific dependency (e.g. @node-rs/argon2, bcrypt) manually is simplest for now.