-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Production build using buildOptimizer is broke but works without buildOptimizer (Angular v6/v7) #17255
Comments
Also see crossbario/autobahn-js#354 |
Heya, was looking into this error and the error happens in What prompts it is indeed the This option affects code removal by signalling that property access has no side effects. We turn this on together with Build Optimizer as part of our suite of advanced optimizations for the smallest bundle size. In some cases, like this one, this option can break existing code. It's not the first time that it has happened but it has been rare enough, and the savings significant enough, that we keep this option on. You have a couple of options that address this problem right now:
Whenever we get a report of this happening we reevaluate the current behaviour to see if it's still desirable. I'll bring this up with the team. |
Thanks for investigating! Will try to add this case to a separate branch for easier reproduction. |
See https://github.com/ClemensSchneider/angular-buildoptimizer-bug/tree/angular7-whenjs for the same showcase but depending on |
It might be a usage issue though. I don't know how the |
Okay, I'll stick to turning off the Build Optimizer for now. |
@filipesilva what is the next actionable step here? Should we move it to the CLI repo? |
I'll bring this up at the next CLI meeting to see if it is worth supporting adding a |
Duplicate of #15761 We can track further there. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
馃悶 bug report
Affected Package
The issue is caused by package
@angular-devkit/build-angular
(this is my assumption)Is this a regression?
Hard to tell as build-dependencies changed from Angular v5 to Angular v6 / v7, right?
Building the original v5 application using
ng build --prod --build-optimizer=true
spit out a working application at least.Description
Building itself works but when trying to launch the application in the browser, an error is logged to the console:
When setting
buildOptimizer
tofalse
, everything works out as expected (no error is logged and application launches).馃敩 Minimal Reproduction
Check out https://github.com/ClemensSchneider/angular-buildoptimizer-bug/tree/angular7 (or https://github.com/ClemensSchneider/angular-buildoptimizer-bug/tree/angular6 for the Angular v6 version).
Run
yarn
to install dependencies, then runyarn build
to build the production build withbuildOptimizer
enabled.Serve the resulting artifacts in
dist/build-optimizer-bug
with a regular http-server and open the application in the browser. You can see, that it errors out without displaying anything.Then, turn off
buildOptimizer
inangular.json
and runyarn build
again. Open the resulting artifacts in the browser again and see, that everything works as expected.馃敟 Exception or Error
馃實 Your Environment
Angular Version (v7):
Angular Version (v6):
Anything else relevant?
The module on which the build optimization chokes is https://www.npmjs.com/package/autobahn
The text was updated successfully, but these errors were encountered: