Skip to content

fix(@angular/build): enhance Vitest resolution for optimal package loading#31816

Merged
clydin merged 1 commit intoangular:mainfrom
clydin:unit-test/vitest-resolve
Nov 14, 2025
Merged

fix(@angular/build): enhance Vitest resolution for optimal package loading#31816
clydin merged 1 commit intoangular:mainfrom
clydin:unit-test/vitest-resolve

Conversation

@clydin
Copy link
Member

@clydin clydin commented Nov 14, 2025

Align Vitest's module resolution with the development server to ensure consistent behavior. This change configures Vitest to prioritize ESM-optimized package entry points by setting 'es2020', 'module', and 'main' as main fields and 'es2015', 'es2020', and 'module' as conditions during module resolution. This improves compatibility and performance by utilizing modern JavaScript module formats where available.

Closes #31808

…ading

Align Vitest's module resolution with the development server to ensure consistent behavior.
This change configures Vitest to prioritize ESM-optimized package entry points by
setting 'es2020', 'module', and 'main' as main fields and 'es2015', 'es2020', and 'module'
as conditions during module resolution. This improves compatibility and performance
by utilizing modern JavaScript module formats where available.
@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Nov 14, 2025
include: options.optimizeDepsInclude,
},
resolve: {
mainFields: ['es2020', 'module', 'main'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this contains some values that could change over time (e.g. es2020), can we decrease the risk of getting out of sync somehow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are there for older APF packages. We stopped using that in newer APF revisions. It's just default now with a single code variant.

@clydin clydin added the action: merge The PR is ready for merge by the caretaker label Nov 14, 2025
@clydin clydin merged commit 9b5a452 into angular:main Nov 14, 2025
81 of 84 checks passed
@clydin
Copy link
Member Author

clydin commented Nov 14, 2025

This PR was merged into the repository. The changes were merged into the following branches:

@clydin clydin deleted the unit-test/vitest-resolve branch November 14, 2025 19:09
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Dec 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rc.3 vitest browser mode issue with tslib

2 participants