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

Support for native async await when using noop zone js #22191

Closed
2 of 15 tasks
thduttonuk opened this issue Nov 18, 2021 · 9 comments · Fixed by #27486
Closed
2 of 15 tasks

Support for native async await when using noop zone js #22191

thduttonuk opened this issue Nov 18, 2021 · 9 comments · Fixed by #27486
Labels
area: devkit/build-angular feature: in backlog Feature request for which voting has completed and is now in the backlog feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Milestone

Comments

@thduttonuk
Copy link
Contributor

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

A way to enable native async/await. We have a large Angular 13 project running absolutely fine without zone.js

Have the ability to remove the plugin-transform-async-to-generator from the transpile stage. I’ve removed manually for now and everything works. The debugging experience is very nice in a no zone.js native async/await Angular project.

Could this be achieved with a new build option?. Or maybe there is a better way to remove the plug-in that I haven't found.

@alan-agius4 alan-agius4 added feature Issue that requests a new feature area: devkit/build-angular labels Nov 18, 2021
@ngbot ngbot bot added this to the Backlog milestone Nov 18, 2021
@angular-robot
Copy link
Contributor

angular-robot bot commented Feb 1, 2022

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Feb 1, 2022
@ngbot ngbot bot modified the milestones: Backlog, needsTriage Feb 1, 2022
@angular-robot
Copy link
Contributor

angular-robot bot commented Feb 22, 2022

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

@HarelM
Copy link

HarelM commented Oct 17, 2023

Is there a way to remove the plugin-transform-async-to-generator using some kind of webpack / babel configuration for specific libraries?
It seems that we introduced an async-await in the worker code and importing this library in Angular completely breaks the library (maplibre-gl) and the angular app.
See the following discussion:
maplibre/maplibre-gl-js#3210

Any help would be approceicated!
cc: @JeanMeche

@birkskyum
Copy link

birkskyum commented Oct 17, 2023

@alan-agius4 , this Feature Request didn't get enough votes two years ago, but when a recent issue was opened with the same request, you closed it as a duplicate of this, without giving it a chance to get the needed votes (it's likely more popular request now due to much higher browser support for await/async). Does it mean that this is already on the roadmap?

@ranma42
Copy link

ranma42 commented Oct 17, 2023

considering that zone.js might be optional https://angular.io/guide/roadmap#improve-runtime-performance-and-developer-experience-with-a-new-reactivity-model using native async-await in Angular might be even more natural than before 🚀

@birkskyum
Copy link

@ranma42 , right, it'll be very convenient, but it's not working yet as of the latest v17.0.0-next.8. Using Signals, and removing zone.js, doesn't pass the reactive system to Signals - instead it's still mandated to add the manual calls for change detection.

@johncrim
Copy link

IMO this voting process deadline doesn't accomodate the idea that most people that use angular don't search for an issue until they encounter it. There are very few angular developers that continually scan the issue list for ideas to vote on.

IMO issues should be re-opened when they exceed 20 votes, if they were closed due to not enough votes.

@alan-agius4 alan-agius4 added feature: under consideration Feature request for which voting has completed and the request is now under consideration and removed feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors labels Oct 20, 2023
@alan-agius4 alan-agius4 added the feature: in backlog Feature request for which voting has completed and is now in the backlog label Jan 11, 2024
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 17, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 17, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 17, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 17, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 17, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 17, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 17, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 18, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 18, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Apr 18, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes angular#22191
alan-agius4 added a commit that referenced this issue Apr 18, 2024
…app is zoneless

This commit updates the esbuild based builders to emit native async/await when `zone.js` is not added as a polyfill.

Closes #22191
@HarelM
Copy link

HarelM commented Apr 21, 2024

Is it possible to use this feature while still using zone?
While there's a big hype and comment around why zone.js is bad and that I shouldn't be using it, there is almost zero documentation on how to really remove it from my app (without almost doing a full rewrite, which for me is counter productive as bundle size is a lot less important than code that actually works well)...

The following library is using zone.js heavily so removing it will require a lot of work, this library is the main reason I commented in this issue:
https://github.com/maplibre/ngx-maplibre-gl

P.S. this is almost the only documentation I found about zone.js and it is describing a super super simple case, and it is obvious that even for this super super simple case, there is a lot of (risky) work that needs to be done:
https://github.com/manfredsteyer/articles/blob/master/angular-elements-without-zonejs.md

@atscott
Copy link
Contributor

atscott commented Apr 21, 2024

Is it possible to use this feature while still using zone

No, in order for ZoneJS to work properly, it needs to patch all async microtasks. Mixing zone-patched tasks with native tasks will result in them executing in the wrong order.

The uses of NgZone in the library you mentioned do not look problematic. There should be no problem using it in a Zoneless application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: devkit/build-angular feature: in backlog Feature request for which voting has completed and is now in the backlog feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Projects
None yet
7 participants