René's URL Explorer Experiment


Title: dev-server keeps stale code of a linked (`file:`) library after `ng-packagr --watch` rebuilds it (rebuild reported, restart required) · Issue #34728 · angular/angular-cli · GitHub

Open Graph Title: dev-server keeps stale code of a linked (`file:`) library after `ng-packagr --watch` rebuilds it (rebuild reported, restart required) · Issue #34728 · angular/angular-cli

X Title: dev-server keeps stale code of a linked (`file:`) library after `ng-packagr --watch` rebuilds it (rebuild reported, restart required) · Issue #34728 · angular/angular-cli

Description: Command serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description In a workspace with an application and a separate Angular libr...

Open Graph Description: Command serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description In a workspace with an...

X Description: Command serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description In a workspace with an...

Opengraph URL: https://github.com/angular/angular-cli/issues/34728

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"dev-server keeps stale code of a linked (`file:`) library after `ng-packagr --watch` rebuilds it (rebuild reported, restart required)","articleBody":"### Command\n\nserve\n\n### Is this a regression?\n\n- [ ] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n_No response_\n\n### Description\n\nIn a workspace with an application and a separate Angular library linked with a `file:` dependency, rebuilding the library in watch mode makes `ng serve` print \"Application bundle generation complete\", but the application bundle (`main.js`) still contains the **previous** compiled code of the library. The new code only appears after stopping and restarting `ng serve`.\n\nThe source map embedded in the same `main.js` already contains the **new** library source (`sourcesContent`), while the code is the old one. So the updated `.map` file seems to be re-read, but the content of `libreria.mjs` is reused from a previous build.\n\nI could not determine whether this is the in-memory load cache, the file watcher, or something else.\n\n### Minimal Reproduction\n\n**Setup**\n\n- Windows, project and library in sibling folders (`D:\\...\\proyecto-22` and `D:\\...\\libreria-22`).\n- Library built with `ng build libreria --watch --configuration development` (ng-packagr).\n- App `package.json`: `\"libreria\": \"file:../libreria-22/dist/libreria\"` (npm `install-links=false`, so `node_modules/libreria` is a Junction to `libreria-22\\dist\\libreria`).\n- `preserveSymlinks` is not set (enabling it is not an option for me: the library sources then resolve under the app's folder and breakpoints in the library do not bind in VS Code).\n- `angular.json` of the app:\n\n  ```json\n  \"build\": {\n    \"configurations\": {\n      \"development\": {\n        \"optimization\": false,\n        \"extractLicenses\": false,\n        \"sourceMap\": { \"scripts\": true, \"styles\": true, \"vendor\": true }\n      }\n    }\n  },\n  \"serve\": {\n    \"options\": {\n      \"poll\": 1000,\n      \"prebundle\": { \"exclude\": [\"libreria\"] }\n    }\n  }\n  ```\n\n- Angular CLI cache enabled (default).\n\n**Steps to reproduce**\n\n1. Create the app and a library (`ng new`, `ng generate library libreria`), and build the library once into `dist/libreria`.\n2. In the app, add `\"libreria\": \"file:../libreria-22/dist/libreria\"` and run `npm install`.\n3. In the library, create a service with a method containing `console.log('v1')`, and call it from the app's root component.\n4. Run `ng build libreria --watch --configuration development` in the library, and `ng serve` in the app.\n5. Change the log in the library service to `console.log('v2')` and wait until ng-packagr finishes.\n\n**Expected:** the dev-server rebuilds and the app runs `v2`.\n\n**Actual:** the terminal prints \"Application bundle generation complete\" but the app still runs `v1`. Searching `main.js` shows the old code:\n\n```js\n// ../libreria-22/dist/libreria/fesm2022/libreria.mjs\n...\nconsole.log(\"v1\");   // old code\n```\n\nwhile the embedded source map has the new source:\n\n```\nsourcesContent: \"... console.log('v2'); ...\"\n```\n\n`dist/libreria/fesm2022/libreria.mjs` on disk does contain the new code. Stopping and restarting `ng serve` fixes it.\n\n**Things I tried without success**\n\n- `poll: 1000` in `serve.options` (with restart).\n- Deleting `.angular/cache` and restarting (works until the next library change).\n- `prebundle.exclude` with the package name.\n- Starting from a shell with the drive letter in uppercase (`D:`) instead of lowercase. \u003cremove this line if you did not launch `ng serve` from that shell>\n\n### Minimum Reproduction\n\nhttps://github.com/LuisEscamillaMartin/repro-linked-lib-stale\n\n### Exception or Error\n\n```text\nNo error. The build reports success.\n```\n\n### Your Environment\n\n```text\nAngular CLI       : 22.2.5\nNode.js           : 24.21.0\nPackage Manager   : npm 11.19.0\nOperating System  : win32 x64\n```\n\n### Anything else relevant?\n\nWithout `preserveSymlinks`, the library is bundled into `main.js` from its real path (`../libreria-22/dist/libreria/fesm2022/libreria.mjs`), outside `node_modules`.","author":{"url":"https://github.com/LuisEscamillaMartin","@type":"Person","name":"LuisEscamillaMartin"},"datePublished":"2026-11-16T10:36:26Z","url":"https://github.com/angular/angular-cli/issues/34728"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:4fe1f2b6-e2da-be6e-b8ee-e3ff0c1ec205
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBDE8:3A4875:2F43725:3F05E5E:6B01DE47
html-safe-nonce26e3ce706d7ec9fbc4e64a52447b4f7c184308deead43bed719f5bab25de072f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREU4OjNBNDg3NToyRjQzNzI1OjNGMDVFNUU6NkIwMURFNDciLCJ2aXNpdG9yX2lkIjoiMjIzMTkzNTQyODUyNzc3NTMwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6ae1a1596a7c27736448edde79bac9289aca42e62cfa3ba13d873718fa659012
hovercard-subject-tagissue:6419353647
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/34728/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a51ee35f137b8cd4ee7a4ef40dcf1c83c86acbf40b585ccd0a33a02013643512/angular/angular-cli/issues/34728
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a51ee35f137b8cd4ee7a4ef40dcf1c83c86acbf40b585ccd0a33a02013643512/angular/angular-cli/issues/34728
og:image:altCommand serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description In a workspace with an...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameLuisEscamillaMartin
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/34728#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34728
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34728
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://github.com/angular/angular-cli/issues/34728
Reloadhttps://github.com/angular/angular-cli/issues/34728
Reloadhttps://github.com/angular/angular-cli/issues/34728
angularhttps://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Codehttps://github.com/angular/angular-cli
Issues198 (198)https://github.com/angular/angular-cli/issues
Pull requests23 (23)https://github.com/angular/angular-cli/pulls
Actionshttps://github.com/angular/angular-cli/actions
Security and quality8 (8)https://github.com/angular/angular-cli/security
Insightshttps://github.com/angular/angular-cli/insights
https://github.com/angular/angular-cli
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34728
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34728
dev-server keeps stale code of a linked (file:) library after ng-packagr --watch rebuilds it (rebuild reported, restart required)https://github.com/angular/angular-cli/issues/34728#top
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
needsTriagehttps://github.com/angular/angular-cli/milestone/11
https://github.com/LuisEscamillaMartin
LuisEscamillaMartinhttps://github.com/LuisEscamillaMartin
on Nov 16, 2026https://github.com/angular/angular-cli/issues/34728#issue-6419353647
https://github.com/LuisEscamillaMartin/repro-linked-lib-stalehttps://github.com/LuisEscamillaMartin/repro-linked-lib-stale
angular-robothttps://github.com/apps/angular-robot
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
on Nov 16, 2026https://github.com/angular/angular-cli/issues/34728#event-36265361124
angular-robothttps://github.com/apps/angular-robot
needsTriagehttps://github.com/angular/angular-cli/milestone/11
on Nov 16, 2026https://github.com/angular/angular-cli/issues/34728#event-36265363889
https://github.com/MeAkib
MeAkibhttps://github.com/MeAkib
on Nov 16, 2026https://github.com/angular/angular-cli/issues/34728#issuecomment-6921809651
@LuisEscamillaMartinhttps://github.com/LuisEscamillaMartin
https://github.com/LuisEscamillaMartin
LuisEscamillaMartinhttps://github.com/LuisEscamillaMartin
on Nov 17, 2026https://github.com/angular/angular-cli/issues/34728#issuecomment-6941504225
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/34728
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34728
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
needsTriageNo due datehttps://github.com/angular/angular-cli/milestone/11
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.