Title: NGCC is non-hermetic and produces different output depending on source location in file system · Issue #39293 · angular/angular · GitHub
Open Graph Title: NGCC is non-hermetic and produces different output depending on source location in file system · Issue #39293 · angular/angular
X Title: NGCC is non-hermetic and produces different output depending on source location in file system · Issue #39293 · angular/angular
Description: 🐞 bug report Affected Package angular/compiler-cli Description NGCC produces different output - specifically, in sourcemap transformation - depending on source location in file system. I have two copies of the same project checked out in...
Open Graph Description: 🐞 bug report Affected Package angular/compiler-cli Description NGCC produces different output - specifically, in sourcemap transformation - depending on source location in file system. I have two c...
X Description: 🐞 bug report Affected Package angular/compiler-cli Description NGCC produces different output - specifically, in sourcemap transformation - depending on source location in file system. I have two c...
Opengraph URL: https://github.com/angular/angular/issues/39293
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"NGCC is non-hermetic and produces different output depending on source location in file system","articleBody":"\u003c!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅\r\n\r\nOh hi there! 😄\r\n\r\nTo expedite issue processing please search open and closed issues before submitting a new one.\r\nExisting issues often contain information about workarounds, resolution, or progress updates.\r\n\r\n🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->\r\n\r\n\r\n# 🐞 bug report\r\n\r\n### Affected Package\r\n\u003c!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->\r\nangular/compiler-cli\r\n\r\n\r\n### Description\r\n\r\nNGCC produces different output - specifically, in sourcemap transformation - depending on source location in file system.\r\n\r\nI have two copies of the same project checked out in two places:\r\n\r\nD:/myproj\r\nD:/myproj-other/myproj\r\n\r\nIf I compare node_modules/@angular/animation between the two (this is just an example), the \"sources\" fields on the source maps in node_modules/@angular/animations/fesm2015 (again, just an example) are different \r\n\r\nD:/myproj-other/myproj/node_modules/@angular/animations/fesm2015/animations.js.map\r\n```\r\n{\"version\":3,\"file\":\"animations.js\",\"sources\":[\"../../../../../../packages/animations/src/animation_builder.ts\",\"../../../../../../packages/animations/src/animation_metadata.ts\",\"../../../../../../packages/animations/src/util.ts\",\"../../../../../../packages/animations/src/players/animation_player.ts\",\"../../../../../../packages/animations/src/players/animation_group_player.ts\",\"../../../../../../packages/animations/src/private_export.ts\",\"../../../../../../packages/animations/src/animations.ts\",\"../../../../../../packages/animations/public_api.ts\",\"../../../../../../packages/animations/index.ts\",\"../../../../../../packages/animations/animations.ts\"],\"names\":\r\n...\r\n```\r\nD:/myproj/node_modules/@angular/animations/fesm2015/animations.js.map\r\n\r\n```\r\n{\"version\":3,\"file\":\"animations.js\",\"sources\":[\"../../../../../packages/animations/src/animation_builder.ts\",\"../../../../../packages/animations/src/animation_metadata.ts\",\"../../../../../packages/animations/src/util.ts\",\"../../../../../packages/animations/src/players/animation_player.ts\",\"../../../../../packages/animations/src/players/animation_group_player.ts\",\"../../../../../packages/animations/src/private_export.ts\",\"../../../../../packages/animations/src/animations.ts\",\"../../../../../packages/animations/public_api.ts\",\"../../../../../packages/animations/index.ts\",\"../../../../../packages/animations/animations.ts\"],\"names\":[\r\n...\r\n```\r\nNote that the number of \"../\" is different between them.\r\n\r\nthe __ivy_ngcc_bak file shows the original:\r\n\r\n```\r\n{\"version\":3,\"file\":\"animations.js\",\"sources\":[\"../../../../../../packages/animations/src/animation_builder.ts\",\"../../../../../../packages/animations/src/animation_metadata.ts\",\"../../../../../../packages/animations/src/util.ts\",\"../../../../../../packages/animations/src/players/animation_player.ts\",\"../../../../../../packages/animations/src/players/animation_group_player.ts\",\"../../../../../../packages/animations/src/private_export.ts\",\"../../../../../../packages/animations/src/animations.ts\",\"../../../../../../packages/animations/public_api.ts\",\"../../../../../../packages/animations/index.ts\",\"../../../../../../packages/animations/animations.ts\"],\r\n...\r\n```\r\n\r\nUnfortunately, this difference is significant if you want to do any sort of build caching between machines as the hashes of the input files of any dependencies on ngcc-processed node_modules are different. This has caused me a lot of pain as I am trying to set up Bazel in our system. I had problems with cache misses between our build servers and developer machines that appears to be caused by this. As a temporary workaround I have had to check in our node_modules, along with ngcc generated files.\r\n\r\nI don't have a firm grasp on the details of this bug, but it appears to me arise from the following code in:\r\n\r\nnode_modules/@angular/compiler-cli/src/ngtsc/sourcemaps/src/source_file.js\r\n\r\n```js\r\nvar sourceMap = {\r\n version: 3,\r\n file: this.fs.relative(sourcePathDir, this.sourcePath),\r\n sources: sources.map(function (sf) { return _this.fs.relative(sourcePathDir, sf.sourcePath); }),\r\n names: names,\r\n mappings: sourcemap_codec_1.encode(mappings),\r\n sourcesContent: sources.map(function (sf) { return sf.contents; }),\r\n };\r\n```\r\n\r\nThe line\r\n```js\r\n sources: sources.map(function (sf) { return _this.fs.relative(sourcePathDir, sf.sourcePath); }),\r\n```\r\n\r\nends up forming a relative path from\r\n\r\nD:/myproj/path/to/file\r\n\r\nto \r\nD:/packages/path/to/file\r\n\r\nObviously this is going to be different if the first path is\r\n\r\nD:/my/nested/checkout/myproj/path/to/file\r\n\r\n\r\n\r\n\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n10.1.5\r\n\r\n**Anything else relevant?**\r\nWindows","author":{"url":"https://github.com/matthewjh","@type":"Person","name":"matthewjh"},"datePublished":"2020-10-15T20:30:10Z","url":"https://github.com/angular/angular/issues/39293"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9addcd36-1dd2-83d1-9900-e4fb97e0d12a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D920:2E3FEE:EB9204:12B3C09:6B010A3C |
| html-safe-nonce | 3dc40fc3beb708709d911724b091d13312ef16159e129a9331f28b619588004e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTIwOjJFM0ZFRTpFQjkyMDQ6MTJCM0MwOTo2QjAxMEEzQyIsInZpc2l0b3JfaWQiOiIzNjk4MTkwNDY1NDE4NDYzODA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3f7c4487335d86818246852abf810d05474aa1c2b25cd4e7d9155abf4c3fc6c9 |
| hovercard-subject-tag | issue:722655900 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/39293/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bf791a2e9fd65aa4cc856205edffceb0ceaf1129cd8b48fc0709179f3b40a984/angular/angular/issues/39293 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bf791a2e9fd65aa4cc856205edffceb0ceaf1129cd8b48fc0709179f3b40a984/angular/angular/issues/39293 |
| og:image:alt | 🐞 bug report Affected Package angular/compiler-cli Description NGCC produces different output - specifically, in sourcemap transformation - depending on source location in file system. I have two c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | matthewjh |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width