You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In current setup there is no possibility to bootstrap angular in web worker mode.
Please add this killer functionality.
Reacted by Ivan Valentinov, drew moore, Guiheux Steven, Duc Anh Trinh, -kaik-, Samuel Van Reeth, William Grasel, Dave Bush, Kostadin Pop-Kochev, armaserg and 149 more
Reacted by Martin and Klemen Oslaj
Reacted by Martin and Klemen Oslaj
Reacted by Serginho, David Reher, cedvdb, Jake Niemiec, Roman Gromov, Wis, Joshua Jolley, JulienBourgain, Actarus, Matteo Ferrando and 31 more
Currently also looking for a good way to accomplish it. Any1 got a workaround for now?
Reacted by Maxime, Kostadin Pop-Kochev, William Grasel, rscottfree, Jake Niemiec, Julieta Campos, Alexander Belov, Jack Clancy, Vlad Dubov, Gleb Mikheev and 3 more
No support at the moment, but we are looking at it.
Reacted by Ajay Navgale, Zeger Knops, William Grasel, rscottfree, Sander Elias, Ahmed Riyad, matthew harwood, Jake Niemiec, bmayen, Julieta Campos and 16 more
Reacted by Maxime, Kostadin Pop-Kochev, Ajay Navgale, Zeger Knops, William Grasel, Ahmed Riyad, Szénási Dániel, matthew harwood, Jake Niemiec, bmayen and 7 more
Reacted by Maxime, cedvdb, Sergey Zhukaev, William Grasel, Zeger Knops, Iliyan Ivanov, Amir Zahedi, Fernando Gómez, rscottfree, Ahmed Riyad and 11 more
I'm also curious if there have been any updates to this.
Reacted by William Grasel, Gabriel Carmo, Zeger Knops, jhertz123, Manish Lakhara, Jake Niemiec, Maxime, bmayen, Julieta Campos, Alexander Belov and 3 more
Now I'm just wondering whether I'm gonna wait for built in solution with the cli or ng eject 😄
Reacted by Antoine, Christophe Chevalier, William Grasel, Jake Niemiec, Piotr Stępniewski, Jack Clancy, Gleb Mikheev, Florent CLAPIÉ, David Reher, Kevin LeStarge and 3 more
Reacted by Jake Niemiec, Jack Clancy, Piotr Stępniewski, Gleb Mikheev, Florent CLAPIÉ, David Reher and Attila Csanyi
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 ... 😃
Don't forget to reference this issue if you try something so we can follow what's going on 👍 !
That is a huge disappointment. We were all very excited about this.
To let everybody know, it is still possible to run parts of your code inside a webworker to make multi-threading possible. I just wish Angular had at least offered the possibility to run services or anything web crawlers don't care much about in separate threads.
I will be digging into making a library to make this behavior possible and developer friendly, any help is welcome. Thanks everybody for the hard work💪
Running Angular itself in a Web Worker (via @angular/platform-webworker) is indeed deprecated. But it is now easier to run parts of your app in a Web Worker using https://angular.io/guide/web-worker.
I came across web workers recently and early thoughts went into the direction of @angular/platform-browser:
abstract the DOM APIs away,
thus, code would run in a worker...
I just flipped the idea the other way around:
DONT ABSTRACT the DOM APIs away,
Extract the supposed to run in a worker-code,
Wrap it in a if no worker-fallback.
You would end up with a style of code like this:
// All worker-compatible code goes to @my/workerimport{WorkerFacade,workerCompatibleCode}from'@my/worker';// WorkerFacade would implement the "if no worker" fallback and messaging from UI to workerconstmyWorker: WorkerFacade=/* ... */construnnableInWorker=myWorker// You would need to map messages to function calls in the worker (not shown here).postToWorker({run: 'workerCompatibleCode',data: {foo: 'bar'}})// workerCompatibleCode() would be run in the UI were web worker isn't available.orElse(()=>workerCompatibleCode());runnableInWorker.subscribe(result=>{console.log("result was returned either from a web worker or from UI process");});
Running Angular inside a web worker has been deprecated for a while now, as it just isn't typically beneficial for performance: https://angular.io/guide/deprecations#webworker-apps. As a result, the CLI doesn't support this use case anymore.
Applications can still add web workers to run their own CPU-intensive tasks, just not running Angular itself. See https://angular.io/guide/web-worker for more on that.
I'd really like to use angular's dependency injection system in my web workers. I have a bunch of heavily modularized Angular services that rely heavily on the Angular DI system. I'd like to use some of those services in a web worker (even if it meant instantiating a secondary service tree that lived on the web worker side.) Does anyone have any suggestions on how to replicate that kind of approach in a web worker? Ideally reusing the actual service code, if possible?
@pshields I assume using Angular DI system directly into a webworker would be hard but I remember that Minko extracted the DI part into a separate project which is browser agnostic (can work on Node) 🎉
Activity
datrinh commentedon Oct 9, 2016
Currently also looking for a good way to accomplish it. Any1 got a workaround for now?
filipesilva commentedon Oct 10, 2016
No support at the moment, but we are looking at it.
armaserg commentedon Dec 29, 2016
Any news here?
Thanks!
alexjlockwood commentedon Feb 20, 2017
I'm also curious if there have been any updates to this.
jhertz123 commentedon Mar 28, 2017
Also looking for this.
IPRIT commentedon Apr 9, 2017
... need this feature!!!
maxime1992 commentedon Apr 15, 2017
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 🎉 !
Now I'm just wondering whether I'm gonna wait for built in solution with the cli or
ng eject😄bmayen commentedon Apr 19, 2017
The stackoverflow approach seems reasonable. Would a PR with this be welcome here?
maxime1992 commentedon Apr 19, 2017
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 ... 😃
Don't forget to reference this issue if you try something so we can follow what's going on 👍 !
jakeNiemiec commentedon Apr 19, 2017
@maxime1992 Thanks for posting that, I'm not sure why workers (--mobile) were cut from angular-cli.
[-]Feat: Run angular2 in web worker mode[/-][+]Feat: Run angular in web worker mode[/+]54 remaining items
LeonBarroso commentedon Mar 13, 2019
@glemiere it gives me webworker.bundle.js not found
where I can find webworker.bundle.js ?
Thanks
cedvdb commentedon Mar 19, 2019
@glemiere good work.
Is angular official support for this ever gonna be a thing ?
bmayen commentedon May 24, 2019
platform-webworkerdeprecatedangular/angular#30642
glemiere commentedon Jun 10, 2019
Indeed @bmayen it's not officially deprecated in v8 angular/angular@361f181
That is a huge disappointment. We were all very excited about this.
To let everybody know, it is still possible to run parts of your code inside a webworker to make multi-threading possible. I just wish Angular had at least offered the possibility to run services or anything web crawlers don't care much about in separate threads.
I will be digging into making a library to make this behavior possible and developer friendly, any help is welcome. Thanks everybody for the hard work💪
filipesilva commentedon Jun 10, 2019
Running Angular itself in a Web Worker (via
@angular/platform-webworker) is indeed deprecated. But it is now easier to run parts of your app in a Web Worker using https://angular.io/guide/web-worker.dherges commentedon Mar 6, 2020
I came across web workers recently and early thoughts went into the direction of
@angular/platform-browser:I just flipped the idea the other way around:
You would end up with a style of code like this:
dgp1130 commentedon Jun 24, 2020
Running Angular inside a web worker has been deprecated for a while now, as it just isn't typically beneficial for performance: https://angular.io/guide/deprecations#webworker-apps. As a result, the CLI doesn't support this use case anymore.
Applications can still add web workers to run their own CPU-intensive tasks, just not running Angular itself. See https://angular.io/guide/web-worker for more on that.
pshields commentedon Jun 24, 2020
I'd really like to use angular's dependency injection system in my web workers. I have a bunch of heavily modularized Angular services that rely heavily on the Angular DI system. I'd like to use some of those services in a web worker (even if it meant instantiating a secondary service tree that lived on the web worker side.) Does anyone have any suggestions on how to replicate that kind of approach in a web worker? Ideally reusing the actual service code, if possible?
maxime1992 commentedon Jun 25, 2020
@pshields I assume using Angular DI system directly into a webworker would be hard but I remember that Minko extracted the DI part into a separate project which is browser agnostic (can work on Node) 🎉
https://github.com/mgechev/injection-js Maybe this will help you
angular-automatic-lock-bot commentedon Jul 27, 2020
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.