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
Describe the bug
Not sure if this goes here, but I figured I'd give it a shot and see what you think of the issue (since your documentation does mention Angular compatibility).
In the last version of Angular, the (default) compile-target is es2018.
Angular uses zone.js to hook into all asyncronous events (setTimeout, XMLHttpRequest, Promise) etc, but zone cannot do this with async or await because they are language constructs. With compile target es2018, async and await no longer get transpiled to Promise, and as a result a warning occurs during build, and change-detection in Angular may fail to be triggered when data changes.
One of the data-mocks dependencies (fetch-mock) uses native async and await, which no longer gets transpiled with es2018, and can therefor cause change-detection issues (as well as trigger a warning during build).
To Reproduce
Steps to reproduce the behavior:
Create an Angular 11 project
Implement data-mocks
Do a build
See warning in terminal
Expected behavior
No warning in terminal
Screenshots
Desktop (please complete the following information):
I realize this is not strictly speaking an issue in data-mocks, but would love a solution to this problem. Would it be possible for data-mocks to import from fetch-mocks/dist/es5/client-bundle instead? I think that would resolve the issue.
The text was updated successfully, but these errors were encountered:
Hi! Thank you so much for creating an issue. I will do my best to get back to you as soon as possible :) If you need to get in contact with me in the meantime, you can ping me on Twitter @davewritescodes
Hey @wimbarelds - that's a really interesting problem you've just brought up.
I happen to be a maintainer for fetch-mock as well - let me speak with the gang there and see if we can sort out a bit more of a solid solution here to save me having to change to that import :)
Describe the bug
Not sure if this goes here, but I figured I'd give it a shot and see what you think of the issue (since your documentation does mention Angular compatibility).
In the last version of Angular, the (default) compile-target is es2018.
Angular uses zone.js to hook into all asyncronous events (
setTimeout
,XMLHttpRequest
,Promise
) etc, but zone cannot do this withasync
orawait
because they are language constructs. With compile target es2018,async
andawait
no longer get transpiled toPromise
, and as a result a warning occurs during build, and change-detection in Angular may fail to be triggered when data changes.One of the data-mocks dependencies (
fetch-mock
) uses nativeasync
andawait
, which no longer gets transpiled with es2018, and can therefor cause change-detection issues (as well as trigger a warning during build).To Reproduce
Steps to reproduce the behavior:
Expected behavior
No warning in terminal
Screenshots
Desktop (please complete the following information):
Additional context
tsconfig:
I realize this is not strictly speaking an issue in data-mocks, but would love a solution to this problem. Would it be possible for data-mocks to import from
fetch-mocks/dist/es5/client-bundle
instead? I think that would resolve the issue.The text was updated successfully, but these errors were encountered: