angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Feat: Run angular in web worker mode

Open k3nsei opened this issue 10 years ago • 65 comments

In current setup there is no possibility to bootstrap angular in web worker mode. Please add this killer functionality.

k3nsei avatar Sep 23 '16 09:09 k3nsei

Currently also looking for a good way to accomplish it. Any1 got a workaround for now?

datrinh avatar Oct 09 '16 12:10 datrinh

No support at the moment, but we are looking at it.

filipesilva avatar Oct 10 '16 13:10 filipesilva

Any news here? Thanks!

armaserg avatar Dec 29 '16 12:12 armaserg

I'm also curious if there have been any updates to this.

alexjlockwood avatar Feb 20 '17 16:02 alexjlockwood

Also looking for this.

jhertz123 avatar Mar 28 '17 11:03 jhertz123

... need this feature!!!

IPRIT avatar Apr 09 '17 23:04 IPRIT

For those who can't wait, I've found a good post on stackoverflow.

I've heard of Angular running in a webworker in the early days of angular. But when you try it out on a real demo : https://kaikcreator.github.io/angular-cli-web-worker/ ... It's something :tada: !

Now I'm just wondering whether I'm gonna wait for built in solution with the cli or ng eject :smile:

maxime1992 avatar Apr 15 '17 18:04 maxime1992

The stackoverflow approach seems reasonable. Would a PR with this be welcome here?

bmayen avatar Apr 19 '17 14:04 bmayen

Gotta try to find out @bmayen ! Seriously I think that yes it'd be welcome and even tho it might not be perfect the first time after few iterations it might go to master ... :smiley:

Don't forget to reference this issue if you try something so we can follow what's going on :+1: !

maxime1992 avatar Apr 19 '17 14:04 maxime1992

@maxime1992 Thanks for posting that, I'm not sure why workers (--mobile) were cut from angular-cli.

jakeNiemiec avatar Apr 19 '17 18:04 jakeNiemiec

This is something that we've been exploring. There's currently limited experimental support that you can try by doing:

npm install --save @angular/service-worker
ng set apps.0.serviceWorker=true
ng build --prod

Now --prod builds will generate and load a service worker.

/cc @alxhub

filipesilva avatar May 04 '17 14:05 filipesilva

@filipesilva, your comment refers to a service worker, but the issue pertains to web workers. Typo or am I missing something here?

bmayen avatar May 04 '17 15:05 bmayen

@filipesilva dude there is fundamental difference between webworker and serviceworker.

k3nsei avatar May 04 '17 15:05 k3nsei

Sorry guys, this was a major durf on my part. Completely misread the issue.

filipesilva avatar May 04 '17 18:05 filipesilva

Service workers would still be nice to have. They don't yet have full modern browser support though, so not as urgent IMO. Web workers on the other hand... :)

bmayen avatar May 04 '17 18:05 bmayen

@bmayen Service workers are available, very nice tutorial here: https://docs.google.com/document/d/19S5ozevWighny788nI99worpcIMDnwWVmaJDGf_RoDY/edit#

mwent-cray avatar Jun 07 '17 16:06 mwent-cray

@mwent-cray, this document is all about Service Workers, not Web Workers. They are different things with different objectives.

willgm avatar Jun 07 '17 16:06 willgm

@willgm I know it is about WEB workers, I was pointing to @bmayen 's post.

mwent-cray avatar Jun 07 '17 16:06 mwent-cray

The tutorial posted by Enrique here:https://medium.com/@enriqueoriol/angular-with-web-workers-step-by-step-dc11d5872135 using the ng eject approach works for a basic app, I tried to get it to work on my Angular 4 application but I had to get rid of 'hammerjs' to remove a window undefined error and now I am getting a PlatformLocation provider error...it seem that the routing module breaks it!

Has anyone had any luck getting webworkers with ng eject working ?

fedeee avatar Jul 06 '17 09:07 fedeee

Unfortunately not, but haven't done too much additional research into it. Our webworker apps simply do not use Angular CLI now :( Not that we wouldn't love to migrate them over though! @filipesilva, is there any chance of bumping this priority up from "nice to have"? I'd argue that it's higher than that because it's major Angular functionality which isn't supported.

bmayen avatar Jul 06 '17 10:07 bmayen