-
Notifications
You must be signed in to change notification settings - Fork 12k
ng build --prod does NOT minify / uglify / remove comments using angular-cli 6 beta #9973
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I see this problem as well. temporary workaround: |
We're still missing the followup PR #9883 that moves the finishes moving the build system and re-enabled The workaround for now is to use |
@filipesilva : According to https://github.com/angular/angular-cli/wiki/build
Though I guess, we must also add I now tested with Chrome says: The problem is I'm not sure if this problem is part of angular itself, or the TypeScript Compiler, or Uglify, or angular-cli because of bad uglify options. The line in the angular source code is here: Could also be due to function inlining, but I'm not sure who's responsible for this. |
I've created a new issue for the encountered error: #9989 |
@filipesilva
|
@IgorMinar I am getting following error when I ran the
|
@filipesilva I have tested and yes bundled files are indeed minified and comments removed, although index.html is not, it stays the same in production build. |
It definitely works (as of latest bits) - but if you have The clue is here in the tab above the javascript code panel: If you're seeing I'm simply running |
I'm viewing the index.html in Sublime not trough Chrome. And it is not minified when using production build, at least in my case. |
Same issue here, index.html is not minified. For now I minified it manualy |
Hello, on my side, the index.html is not minified and I can't explain why but the code is not compiled with the good target defined (es5) in tsconfig.json and then the code is not compatible with IE11. (because of arrow functions in the main JS file) |
I am still experiencing issues related to the --prod mode(ng build --prod --base-href=/). When running "ng build --prod" it works but "environment.production" is false. Running "ng build --target=production --prod --base-href=/" leads to: Cannot determine project or target for Architect command. The @angular/cli that I am using now is "version": "6.0.5" |
Ok, so I have fixed the issue referencing the environment in the "src/environments/environment" not that one in the "src/app/environment". |
Thanks a lot Radoslav!!! May I ask you to keep us posted when the fix will be released? Thanks again! |
Well it seems that the "app/environment.ts" is a left over from the updated to angular 6 project. If you create a brand new app using "ng new " - that file is no longer there. |
I had the same issue after upgrading to Angular CLI 6.x, my solution to the issue was: |
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. |
Versions
Repro steps
Also tested:
And optional:
"target"
from"es5"
to"es2015"
intsconfig.json
Observed behavior
The resulting file sizes vary a little bit, depending on the used settings (angular 5, angular 6 beta, es5 or es2015).
Desired behavior
Much smaller bundle sizes.
Mention any other details that might be useful (optional)
When looking at the generated .js files, I can see lot's of whitespaces, comments, etc. pp. Though I guess that uglify is not running.
There's no error in the output. The only warning in the output (you can see above) is
DeprecationWarning: Tapable.plugin is deprecated. Use new API on
.hooksinstead
The same results could be observed when using
@angular/cli: 6.0.0-beta.4
.The text was updated successfully, but these errors were encountered: