René's URL Explorer Experiment


Title: Production build optimization breaks code · Issue #11439 · angular/angular-cli · GitHub

Open Graph Title: Production build optimization breaks code · Issue #11439 · angular/angular-cli

X Title: Production build optimization breaks code · Issue #11439 · angular/angular-cli

Description: Bug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Area - [x] devkit - [ ] schematics Versions Windows node v9.4.0 npm v5.6.0 Repro steps Use a third party libr...

Open Graph Description: Bug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Area - [x] devkit - [ ] schematics Versions Windows node v9.4.0 npm v...

X Description: Bug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Area - [x] devkit - [ ] schematics Versions Windows node v9.4.0 np...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Production build optimization breaks code","articleBody":"### 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\nWindows \r\nnode v9.4.0\r\nnpm v5.6.0\r\n\r\n### Repro steps\r\nUse a third party library that contain non-side effect free getters.\r\nRun a production build.\r\nObserver that the code breaks at runtime, whereas it runs fine without \"optimization\".\r\n\r\nE.g.:\r\n\r\n * Scaffold a project that uses code (e.g. a third party library) that contains code that cannot be properly \"optimized\" using uglifyjs with it's default settings. E.g. code that uses \"non-pure getters\" like this:\r\n```\r\nlet object = {};\r\nObject.defineProperty(object,\"nonSideEffectFreeGetterBasedMember\", \r\n    {get: function(){ console.log(\"side effect\")}});\r\n\r\n(function () {\r\n  object.nonSideEffectFreeGetterBasedMember;\r\n}());\r\n```\r\n * Enable the angular build optimizer\r\n * Run the program with the build optimizer enabled and observe that the code does not work as expected anymore, because the non-pure getter has been removed and the side-effect does not happen anymore.\r\n\r\n### The log given by the failure\r\nn/a - it's a runtime issue in the application\r\n\r\n### Desired functionality\r\nThe optimization step should optimize, but never break code. The \"pure_getters\" option should be configurable and by default \"false\" should be used to guarantee best possible compatibility. If someone wants to optimize further and take the risk, that's fine, but don't break code by default: Don't be optimistic or dictate how code should work in your opinion. \r\nIdeally make it possible to exclude specific libraries from this treatment. Users may have no control over these libraries and patching them often is not an option.\r\n\r\n### Mention any other details that might be useful\r\nThis has been reported before but was always closed without comments or with a comment that the third party code should be changed to workaround this limitation in angular. This is a one-liner fix in angular, though and instead of dictating how third party code should be written, the CLI should try not to break existing code, instead. Debugging \"optimized  production code\" is a PITA the gains are minimal compared to that. Make this a configurable setting and make it possible to exclude certain files or third party libraries.\r\n\r\nThese are the previous issues that all had the same cause and where closed or ignored with no further explanation:\r\nhttps://github.com/angular/angular-cli/issues/9231\r\nhttps://github.com/angular/angular-cli/issues/9221\r\nhttps://github.com/angular/devkit/issues/937\r\nhttps://github.com/angular/devkit/issues/388\r\nhttps://github.com/angular/devkit/issues/612\r\nand probably some more.\r\n\r\nWe are a library provider and we had several customers running into that issue. It's a nightmare to debug and analyze and devs expect that there is no behavior change when the \"optimizer\" is turned on. But there can be and is a change: it breaks their projects in all kinds of ways.\r\n\r\n### Proposed workaround for people affected by this bug\r\nGo and hack the buildoptimizer options in the code. Find [the line](https://github.com/angular/angular-cli/blob/3108ce30ab429cff581b888a5f88118d3400ad99/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L221) that sets the pure_getters option to true or \"strict\" and set it to \"false\" instead. If there is no such line, make sure that \"false\" is used (because the default is true and breaks code).","author":{"url":"https://github.com/yGuy","@type":"Person","name":"yGuy"},"datePublished":"2018-07-03T15:16:22Z","url":"https://github.com/angular/angular-cli/issues/11439"}

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:72e7af62-c31f-7e30-399c-bb7a0b12b205
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id897C:1C6C3E:1086E07:15D1C8C:6B010CB4
html-safe-nonce3e5ac591c1a55027be4c8ea454456adeecc73e4857aa96e081a870b482ec97a1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTdDOjFDNkMzRToxMDg2RTA3OjE1RDFDOEM6NkIwMTBDQjQiLCJ2aXNpdG9yX2lkIjoiNDcwMzI3NzYyMzczODk2MTA3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac0426d485113e3779925d41621c7cc8e4577366794be1105586470ffb221c662c
hovercard-subject-tagissue:337944543
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/11439/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0af922085268cae6b9c9b30652f194dc386817fa40bc23dd5180ce31865ab6d9/angular/angular-cli/issues/11439
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0af922085268cae6b9c9b30652f194dc386817fa40bc23dd5180ce31865ab6d9/angular/angular-cli/issues/11439
og:image:altBug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Area - [x] devkit - [ ] schematics Versions Windows node v9.4.0 npm v...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameyGuy
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
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
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/11439#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F11439
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%2F11439
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/11439
Reloadhttps://github.com/angular/angular-cli/issues/11439
Reloadhttps://github.com/angular/angular-cli/issues/11439
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/11439
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/11439
Production build optimization breaks codehttps://github.com/angular/angular-cli/issues/11439#top
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
Backloghttps://github.com/angular/angular-cli/milestone/12
https://github.com/yGuy
yGuyhttps://github.com/yGuy
on Jul 3, 2018https://github.com/angular/angular-cli/issues/11439#issue-337944543
#9231https://github.com/angular/angular-cli/issues/9231
#9221https://github.com/angular/angular-cli/issues/9221
angular/devkit#937https://github.com/angular/devkit/issues/937
angular/devkit#388https://github.com/angular/devkit/issues/388
angular/devkit#612https://github.com/angular/devkit/issues/612
the linehttps://github.com/angular/angular-cli/blob/3108ce30ab429cff581b888a5f88118d3400ad99/packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/common.ts#L221
Nexthttps://github.com/angular/angular-cli/issues/11439?timeline_page=1
https://github.com/psamusev
psamusevhttps://github.com/psamusev
on Jul 9, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-403407918
filipesilvahttps://github.com/filipesilva
comp: devkit/build-optimizerhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22comp%3A%20devkit%2Fbuild-optimizer%22
on Jul 19, 2018https://github.com/angular/angular-cli/issues/11439#event-1742495426
https://github.com/filipesilva
filipesilvahttps://github.com/filipesilva
on Jul 20, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-406551094
angular/devkit#612https://github.com/angular/devkit/issues/612
filipesilvahttps://github.com/filipesilva
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
on Jul 20, 2018https://github.com/angular/angular-cli/issues/11439#event-1744434717
https://github.com/yGuy
yGuyhttps://github.com/yGuy
on Jul 20, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-406561945
angular/devkit#388https://github.com/angular/devkit/issues/388
https://github.com/fbernhard
fbernhardhttps://github.com/fbernhard
on Sep 5, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-418766787
https://github.com/mishoo/UglifyJS2https://github.com/mishoo/UglifyJS2
@yGuyhttps://github.com/yGuy
https://github.com/clydin
clydinhttps://github.com/clydin
on Sep 5, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-418772149
https://github.com/yGuy
yGuyhttps://github.com/yGuy
on Sep 5, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-418789603
https://github.com/clydin
clydinhttps://github.com/clydin
on Sep 5, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-418796185
https://github.com/yGuy
yGuyhttps://github.com/yGuy
on Sep 6, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-419001026
https://github.com/clydin
clydinhttps://github.com/clydin
on Sep 6, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-419166812
https://github.com/fbernhard
fbernhardhttps://github.com/fbernhard
on Sep 6, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-419174509
@clydinhttps://github.com/clydin
https://github.com/yGuy
yGuyhttps://github.com/yGuy
on Sep 7, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-419341774
@clydinhttps://github.com/clydin
here a list of librarieshttps://www.npmjs.com/
https://github.com/dschoeni
dschoenihttps://github.com/dschoeni
on Oct 9, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-428234433
bitcoinjs/bitcoinjs-lib#959https://github.com/bitcoinjs/bitcoinjs-lib/issues/959
https://github.com/shileen
shileenhttps://github.com/shileen
on Oct 23, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-432324978
@yGuyhttps://github.com/yGuy
https://github.com/mordka
mordkahttps://github.com/mordka
on Nov 2, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-435361998
https://github.com/fbernhard
fbernhardhttps://github.com/fbernhard
on Nov 3, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-435562887
https://github.com/ALMaclaine/replacehttps://github.com/ALMaclaine/replace
https://github.com/shileen
shileenhttps://github.com/shileen
on Nov 3, 2018https://github.com/angular/angular-cli/issues/11439#issuecomment-435576436
@fbernhardhttps://github.com/fbernhard
Here's a good example of how to use that. https://blog.callstack.io/say-goodbye-to-old-fashioned-forks-thanks-to-the-patch-package-3c63a62eea1c
hanslhttps://github.com/hansl
needs: discussionOn the agenda for team meeting to determine next stepshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22needs%3A%20discussion%22
on Jan 24, 2019https://github.com/angular/angular-cli/issues/11439#event-2095248016
https://github.com/earshinov
earshinovhttps://github.com/earshinov
on Jan 29, 2019https://github.com/angular/angular-cli/issues/11439#issuecomment-458708331
calebhieberthttps://github.com/calebhiebert
on Mar 2, 2019https://github.com/angular/angular-cli/issues/11439#event-2176019576
impliment hack fix due tohttps://github.com/calebhiebert/dd/commit/c803e4bbbe38b277ae6dfee987801a4433dbf153
c803e4bhttps://github.com/calebhiebert/dd/commit/c803e4bbbe38b277ae6dfee987801a4433dbf153
https://github.com/adrianhara
adrianharahttps://github.com/adrianhara
on Apr 8, 2019https://github.com/angular/angular-cli/issues/11439#issuecomment-480799946
@alexeaglehttps://github.com/alexeagle
filipesilvahttps://github.com/filipesilva
on Apr 16, 2019https://github.com/angular/angular-cli/issues/11439#event-2279837387
fix(@angular-devkit/build-angular): remove pure_gettershttps://github.com/filipesilva/angular-cli/commit/0f4cf193dad5b7f62faa5ebfda30be15df4a8c4e
0f4cf19https://github.com/filipesilva/angular-cli/commit/0f4cf193dad5b7f62faa5ebfda30be15df4a8c4e
fix(@angular-devkit/build-angular): remove pure_gettershttps://github.com/filipesilva/angular-cli/commit/04322b3517e609a1d2d43142b5e80419ff5e53d1
04322b3https://github.com/filipesilva/angular-cli/commit/04322b3517e609a1d2d43142b5e80419ff5e53d1
fix(@angular-devkit/build-angular): remove pure_gettershttps://github.com/filipesilva/angular-cli/commit/88fc7f60f56797f5d25713b95e579d3f08e65f5a
88fc7f6https://github.com/filipesilva/angular-cli/commit/88fc7f60f56797f5d25713b95e579d3f08e65f5a
alexeaglehttps://github.com/alexeagle
on Apr 24, 2019https://github.com/angular/angular-cli/issues/11439#event-2297891127
fix(@angular-devkit/build-angular): remove pure_gettershttps://github.com/angular/angular-cli/commit/9a9939fc4eb92f50241bc1e46b6623505a587bc5
9a9939fhttps://github.com/angular/angular-cli/commit/9a9939fc4eb92f50241bc1e46b6623505a587bc5
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 9, 2019https://github.com/angular/angular-cli/issues/11439#issuecomment-529431783
automatic conversation locking policyhttps://github.com/angular/angular/blob/67d80f/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 9, 2019https://github.com/angular/angular-cli/issues/11439#event-2618359467
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/11439
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/11439
featureLabel used to distinguish feature request from other issueshttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22feature%22
BacklogNo due datehttps://github.com/angular/angular-cli/milestone/12
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.