Repository navigation
fix(@angular/build): apply build conditions to dev server prebundling - #34839
Open
damienwebdev wants to merge 2 commits into
Open
damienwebdev wants to merge 2 commits into
damienwebdev wants to merge 2 commits into
Conversation
Pass the build `conditions` to Vite's client and SSR `resolve.conditions`. Without them, prebundled packages resolve with Vite's default conditions and `ng serve` runs different code than `ng build`. Fixes angular#34834
There was a problem hiding this comment.
Code Review
This pull request updates the Angular dev-server Vite integration to support custom resolve conditions for both browser and SSR prebundling, and adds a new test suite to verify this behavior. The review feedback recommends checking for non-empty arrays (conditions?.length) instead of just truthiness to avoid applying empty resolve conditions, and suggests extending the tests to cover this empty array scenario.
5 of 16 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The dev server doesn't pass the build
conditionsto Vite. With prebundling enabled (the default), Vite's dependency optimizer resolves packages with its default conditions, song servecan run different code thanng buildfor packages with conditional exports. This affects both the browser and SSR.Fixes #34834
What is the new behavior?
Pass the build
conditionsto Vite's client and SSRresolve.conditions. Without them, prebundled packages resolve with Vite's default conditions andng serveruns different code thanng build.Does this PR introduce a breaking change?
Other information