Open wimbarelds opened 3 years ago
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 :)
Thanks @grug , that's actually quite convenient :-), hope you manage to figure something out for this.
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![image](https://user-images.githubusercontent.com/2588383/105839780-46c4b700-5fd2-11eb-9a17-cc42593d4644.png)
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.