Title: bug(build-optimizer): initial Map values are stripped unnecessarily · Issue #364 · angular/devkit · GitHub
Open Graph Title: bug(build-optimizer): initial Map values are stripped unnecessarily · Issue #364 · angular/devkit
X Title: bug(build-optimizer): initial Map values are stripped unnecessarily · Issue #364 · angular/devkit
Description: This code in the @angular/animations package gets compiled incorrectly when the build optimizer is turned on: // DO NOT REFACTOR ... keep the follow set instantiations // with the values intact (closure compiler for some reason // remove...
Open Graph Description: This code in the @angular/animations package gets compiled incorrectly when the build optimizer is turned on: // DO NOT REFACTOR ... keep the follow set instantiations // with the values intact (cl...
X Description: This code in the @angular/animations package gets compiled incorrectly when the build optimizer is turned on: // DO NOT REFACTOR ... keep the follow set instantiations // with the values intact (cl...
Opengraph URL: https://github.com/angular/devkit/issues/364
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug(build-optimizer): initial Map values are stripped unnecessarily","articleBody":"[This code in the `@angular/animations` package](https://github.com/angular/angular/blob/master/packages/animations/browser/src/dsl/animation_transition_expr.ts#L68-L73) gets compiled incorrectly when the build optimizer is turned on:\r\n\r\n ```\r\n// DO NOT REFACTOR ... keep the follow set instantiations\r\n// with the values intact (closure compiler for some reason\r\n// removes follow-up lines that add the values outside of\r\n// the constructor...\r\nconst TRUE_BOOLEAN_VALUES = new Set\u003cstring>(['true', '1']);\r\nconst FALSE_BOOLEAN_VALUES = new Set\u003cstring>(['false', '0']);\r\n```\r\n\r\nWITHOUT optimization:\r\n\r\n```\r\nvar TRUE_BOOLEAN_VALUES = new Set();\r\nTRUE_BOOLEAN_VALUES.add('true');\r\nTRUE_BOOLEAN_VALUES.add('1');\r\nvar FALSE_BOOLEAN_VALUES = new Set();\r\nFALSE_BOOLEAN_VALUES.add('false');\r\nFALSE_BOOLEAN_VALUES.add('0');\r\n```\r\n\r\nWITH optimization:\r\n```\r\nvar TRUE_BOOLEAN_VALUES = new Set();\r\nvar FALSE_BOOLEAN_VALUES = new Set();\r\n```\r\n\r\nYou can see that the initialization is being stripped out causing animations that rely upon boolean values not to match, and so not run.\r\n\r\nThis use case was identified in the AIO application, where we wanted to use boolean based animation states.\r\n\r\n```\r\n animations: [\r\n trigger('accordion', [\r\n state('true', style({height: '*'})),\r\n state('false', style({height: 0})),\r\n transition('true => false', animate(250))\r\n ])\r\n```\r\n\r\nYou could see the animations working without the optmizer `ng start --prod --build-optimizer=false` but as soon as you ran in production mode `ng start --prod` the animation was not matching and so not being played.\r\n\r\nWe worked around it by using string based animation states instead:\r\n\r\n```\r\n animations: [\r\n trigger('accordion', [\r\n state('show', style({height: '*'})),\r\n state('hide', style({height: 0})),\r\n transition('show => hide', animate(250))\r\n ])\r\n```\r\n### Bug Report or Feature Request (mark with an `x`)\r\n```\r\n- [x] bug report -> please search issues before submitting\r\n- [ ] feature request\r\n```\r\n\r\n### Area\r\n```\r\n- [x] devkit\r\n- [ ] schematics\r\n```\r\n\r\n### Versions\r\n\r\n* node: v8.9.4\r\n* OS: High Sierra\r\n* @angular-devkit/build-optimizer: 0.0.31\r\n","author":{"url":"https://github.com/petebacondarwin","@type":"Person","name":"petebacondarwin"},"datePublished":"2018-01-09T13:46:46Z","url":"https://github.com/angular/devkit/issues/364"}
| 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:92ecb3c9-4ccd-a39a-ec6c-8ffb47b4a36d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E780:1DCB8C:1B95195:245E085:6B014F05 |
| html-safe-nonce | 5b46cac5c8ea8e90a1b4de85f4b5b7b01d9e497361c01fbc822dad4bea989050 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzgwOjFEQ0I4QzoxQjk1MTk1OjI0NUUwODU6NkIwMTRGMDUiLCJ2aXNpdG9yX2lkIjoiMjEwMjc2MDM4NjI0NzU5NTU3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 853a4460a933bb0721d50e9c9aa4589b0fbb633b22d980aa8c87b6f2cf86920b |
| hovercard-subject-tag | issue:287093795 |
| 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/devkit/364/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f5c30f5171651147b76b6d4d2bb4a41618bdab11bc4f6f9ea6122fcf4af0df2a/angular/devkit/issues/364 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f5c30f5171651147b76b6d4d2bb4a41618bdab11bc4f6f9ea6122fcf4af0df2a/angular/devkit/issues/364 |
| og:image:alt | This code in the @angular/animations package gets compiled incorrectly when the build optimizer is turned on: // DO NOT REFACTOR ... keep the follow set instantiations // with the values intact (cl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | petebacondarwin |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/devkit git https://github.com/angular/devkit.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 88288940 |
| octolytics-dimension-repository_nwo | angular/devkit |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 88288940 |
| octolytics-dimension-repository_network_root_nwo | angular/devkit |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width