Since the last update from version 0.27.1.7935 to version 0.28.1.8199 fuse keeps telling me, that
JS stack trace: ReferenceError: fetch is not defined
but the code hasn’t changed in any way and it worked fine before.
did i miss something? is there now a replacement for fetch or so?
I can’t see any code changes that would lead to this. I am pretty sure fetch is working for other users. How do you use it?
Yes, you’re right. I still haven’t found out what’s wrong, but it’s not a bug indeed as it seems.
I created a whole new project just contaning the MainView.ux
<App>
<JavaScript File="MainView.js" />
</App>
And the MainView.js
function test() {
fetch('http://www.google.com/', {
method: 'POST',
async: false
}).then(function(response) {
console.log(JSON.stringify(response));
}).catch(function(err) {
console.log(JSON.stringify(err));
});
}
test();
And that one works pretty fine.
Sorry for bringing this up, before testing it properly.
And i finally found the reason too.
I do have two JavaScript Modules in my code, which i do include in the .unoproj file with
"Includes": [
"FirstModule.js:Bundle",
"SecondModule.js:Bundle",
]
I do use them in the MainView.js with
var firstModule = require('/FirstModule');
var secondModule = require('/SecondModule');
that’s working fine, BUT i also had this in the MainView.ux:
<JavaScript File="FirstModule.js" ux:Global="LanguagesModule" />
<JavaScript File="SecondModule.js" ux:Global="LanguagesModule" />
<JavaScript File="MainView.js" />
For some reasons i don’t know, that worked before and now lead to the JS stack trace: ReferenceError: fetch is not defined
error.
So all i changed the MainView.ux into this
<JavaScript File="MainView.js" />
and now the error is gone.
Hope this might help someone else too.