Repository navigation
fix(@angular/build): improve library bundler resolution and watch shared chunk consistency - #34440
Open
alan-agius4 wants to merge 7 commits into
Open
alan-agius4 wants to merge 7 commits into
alan-agius4 wants to merge 7 commits into
Conversation
…red chunk consistency - Strip trailing slashes when resolving relative directory imports in `createMemoryFileLoaderPlugin` so `./dir/` resolves `.../dir/index.js`. - Support `.cjs` and `.d.cts` extensions, and prioritize `.d.mts`/`.d.cts` before `.d.ts` when resolving explicit `.mjs`/`.cjs` specifiers in `.d.ts` mode. - Treat Windows drive-letter absolute paths (`/^[a-zA-Z]:\//`) as internal modules. - Fall back to on-disk declaration files in `.d.ts` mode for hand-authored ambient/declaration files not emitted into the in-memory `dtsFiles` map. - Re-bundle all entry points from in-memory outputs during partial watch rebuilds when previous bundle results contained shared chunks to prevent inlining shared code into a subset of entry points.
…tch shared chunk consistency
…tch shared chunk consistency
alan-agius4
marked this pull request as ready for review
October 21, 2026 06:50
There was a problem hiding this comment.
Code Review
This pull request enhances the library bundler pipeline to maintain shared chunk consistency during watch mode rebuilds and improves path resolution in the memory file loader plugin, including handling trailing slashes, Windows drive-letter paths, and preferring .d.mts for .mjs specifiers. A high-severity issue was identified where partial rebuilds that only trigger ESM or DTS changes will fail to update bundleResults due to a strict check requiring both bundles to be present, which can lead to stale file cleanup issues or unnecessary full rebuilds.
…tch shared chunk consistency
…tch shared chunk consistency
…tch shared chunk consistency
…tch shared chunk consistency
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.
Summary
Fixes module resolution issues in
createMemoryFileLoaderPluginand ensures shared chunk consistency during partial watch-mode rebuilds in the@angular/build:librarybundler pipeline:import './dir/') before probing candidate extensions so.../dir/index.jsis resolved instead of.../dir//index.js..mjs->.d.mtsdeclaration preference: In.d.tsbundling mode, prefer.d.mtswhen an explicit.mjsspecifier is used and both.d.tsand.d.mtsexist.C:/...) as internal modules inresolveIdrather than marking them as external.fesm2022/shared-*.mjsortypes/shared-*.d.ts), expand the Rolldown invocation to include all entry points present in the in-memoryesmFiles/dtsFilesmaps and updatebundleResultsfor all bundled entry points so shared chunk hashes and stale file cleanup remain consistent.