fix: rework browser optimizeDeps.entries
#560
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
optimizeDeps
#562I thought having this is safe, but in practice, it looks like this would cause pre-bundling error (or just warning?) since it goes through a lot of server only dependencies whose resolutions somehow fail on browser resolver.
One example is when crawling
@node-rs/argon2
hi-ogawa/lucia-auth-examples#1 (comment)Not having this is okay since this is only to prevent dev full reload on late dep discovery (also users still have a way to configure it on their own), but there might be still a cheap attempt to mitigate this.
Some ideas:
optimizeDeps.entries
and let users configure it (withoptimizeDeps.exclude
to counter against if they need)"use client"
files?routes/**/*
filesoptimizeDeps.entries
after we collectedclientReferenceMap
by loading server routes