This repository was archived by the owner on Apr 4, 2025. It is now read-only.

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
`-- @angular/cli@1.6.4
`-- @angular-devkit/build-optimizer@0.0.38
node -v // 8.5.0
npm -v // 5.5.1
Repro steps
Clone this reproduction repository and run the app in two different ways:
- With the build optimizer (using
-prod --aot)
- Without the build optimizer (using
-prod --aot --build-optimizer=false)

The highlighted code snippet here (picture from the ESM 5 file button.js file) is being removed when running with the build optimizer. If you add a console.log before, the console.log stays, just the specific code snippet is being removed.
Switching to a ternary, or simple if-else will fix the issue.
with build-optimizer disabled

_with build-optimizer enabled

Mention any other details that might be useful
Related to Angular Material. angular/components#9360
cc. @filipesilva