Skip to content

fix(@angular/build): align lazy route entry names with workspace root for SSR modulepreload - #34373

Open
alan-agius4 wants to merge 1 commit into
angular:22.2.xfrom
alan-agius4:fix/ssr-lazy-route-base-path-22.2.x
Open

alan-agius4 wants to merge 1 commit into
angular:22.2.xfrom
alan-agius4:fix/ssr-lazy-route-base-path-22.2.x

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Cherry-pick of #34372 to 22.2.x

… for SSR modulepreload

Override `compilerOptions.basePath` with `build.initialOptions.absWorkingDir` when initializing the Angular compilation so `lazyRoutesTransformer` computes `ɵentryName` relative to the workspace root rather than the tsconfig directory. This matches the workspace-relative keys in `entryPointToBrowserMapping` used for SSR `modulepreload` link generation when the application's `tsconfig` is not located at the workspace root.

Closes angular#34369
@alan-agius4
alan-agius4 requested a review from clydin October 16, 2026 07:55
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Oct 16, 2026

@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 introduces support for overriding the basePath compiler option in the Angular build tools. It updates CompilerOptionOverrides and transformCompilerOptions to accept and apply basePath, and integrates this into the esbuild compiler plugin using build.initialOptions.absWorkingDir. Additionally, test coverage is added for these changes and chunk optimization verification is updated. Feedback suggests defaulting basePath to process.cwd() in the compiler plugin if absWorkingDir is undefined, preventing potential misalignment between esbuild and the Angular compiler.

Comment thread packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts
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 target: patch This PR is targeted for the next patch release

Projects

None yet

1 participant