Skip to content

fix(@angular/build): link partial Ivy dependencies in Vitest runner - #34200

Closed
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix-vitest-partial-ivy
Closed

alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix-vitest-partial-ivy

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Closes #34198

@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/build labels Sep 29, 2026
@alan-agius4
alan-agius4 force-pushed the fix-vitest-partial-ivy branch from 34e669b to 885c783 Compare September 29, 2026 12:24
@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Sep 29, 2026
@alan-agius4
alan-agius4 requested a review from clydin September 29, 2026 12:48
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Sep 29, 2026
@alan-agius4
alan-agius4 marked this pull request as ready for review September 29, 2026 12:48

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request integrates the Angular linker into the Vitest unit test runner by utilizing JavaScriptTransformer to link partially-compiled packages. It also configures dependency optimization using browser targets and adds a behavior test to verify the linking process. The review feedback suggests optimizing the angular:linker plugin by using the existing textDecoder to decode transformed data instead of creating a temporary Buffer instance.

Comment on lines +357 to +359
const transformedData = await prebundleTransformer.transformData(id, code);

return Buffer.from(transformedData).toString('utf-8');

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Since textDecoder is already instantiated at the module level (line 323), we can use it here to decode transformedData instead of creating a temporary Node.js Buffer instance. This is more consistent with the rest of the file and avoids unnecessary buffer allocations.

Suggested change
const transformedData = await prebundleTransformer.transformData(id, code);
return Buffer.from(transformedData).toString('utf-8');
const transformedData = await prebundleTransformer.transformData(id, code);
return textDecoder.decode(transformedData);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/build area: performance Issues related to performance target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unit-test builder (Vitest, 22.2.0 OXC linker): ReferenceError on class referenced by name before its own declaration in a partially-compiled npm library

1 participant