Skip to content
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

ng build --prod doesn't minified ngsw-worker.js #9970

Closed
adrian-daniel-garcia opened this issue Mar 15, 2018 · 7 comments
Closed

ng build --prod doesn't minified ngsw-worker.js #9970

adrian-daniel-garcia opened this issue Mar 15, 2018 · 7 comments

Comments

@adrian-daniel-garcia
Copy link

When building for production environment ngsw-worker/js file included in /DIST folder isn;y minified. We can save 75 KB and get better performance

Version 1.7.3

Angular CLI: 1.7.3
Node: 9.5.0
OS: win32 x64
Angular: 5.2.8
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

Repro steps

  • Step 1: run ng build --prod
  • Step 2 go to dist foled
  • Step 3 Open the ngsw-worker.js. You will see coment and a readeable js file

Observed behavior

The file contains 107KB of code

Desired behavior

The file is minified and contains less than 35KB of code

@awerlang
Copy link
Contributor

Neither it is transpiled down to ES5. Service workers are supported in environments where async functions aren't (Chrome <= 54) so it fails.

@topaxi
Copy link

topaxi commented May 31, 2018

It seems to be transpiled down to ES2015 now, using generators instead of async/await. Still no minification though.

@etiennetalbot
Copy link

etiennetalbot commented Aug 10, 2018

Just leaving a note here... Be very careful about fixing this bug as a lot of people are working around this issue angular/angular#21191 by inserting specific code in this very file. See comment: angular/angular#21191 (comment)

Maybe issue angular/angular#21191 should be addressed first

EDIT: I know that this issue shouldn't depend on the other one. If a fix is possible to minify ngsw-worker.js, it should be addressed.

@ngbot ngbot bot added this to the needsTriage milestone Jan 24, 2019
@filipesilva
Copy link
Contributor

filipesilva commented Jan 29, 2019

Heya, this issue is the same as #11538. I'm closing this one in favor of that one because it has an answer from the team member responsible for service workers.

@awerlang
Copy link
Contributor

@filipesilva this one is #9970, I guess you mean another.

@filipesilva
Copy link
Contributor

@awerlang sorry about that, fixed the link now.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants