rn-fetch-blob
rn-fetch-blob copied to clipboard
Require cycle
Require cycle: node_modules/rn-fetch-blob/index.js -> node_modules/rn-fetch-blob/polyfill/index.js -> node_modules/rn-fetch-blob/polyfill/FileReader.js -> node_modules/rn-fetch-blob/index.js
It is recommended to solve this problem!
I'm also getting these warnings on the new version of react-native.
Require cycle: node_modules/rn-fetch-blob/index.js -> node_modules/rn-fetch-blob/polyfill/index.js -> node_modules/rn-fetch-blob/polyfill/Blob.js -> node_modules/rn-fetch-blob/index.js
Require cycle: node_modules/rn-fetch-blob/index.js -> node_modules/rn-fetch-blob/polyfill/index.js -> node_modules/rn-fetch-blob/polyfill/XMLHttpRequest.js -> node_modules/rn-fetch-blob/index.js
Require cycle: node_modules/rn-fetch-blob/index.js -> node_modules/rn-fetch-blob/polyfill/index.js -> node_modules/rn-fetch-blob/polyfill/FileReader.js -> node_modules/rn-fetch-blob/index.js
Require cycle: node_modules/rn-fetch-blob/index.js -> node_modules/rn-fetch-blob/polyfill/index.js -> node_modules/rn-fetch-blob/polyfill/Fetch.js -> node_modules/rn-fetch-blob/index.js
Same issue
same issue
same issue
Yes, I've faced the same issue here.
Require cycle: node_modules/rn-fetch-blob/index.js -> node_modules/rn-fetch-blob/polyfill/index.js -> node_modules/rn-fetch-blob/polyfill/Blob.js -> node_modules/rn-fetch-blob/index.js
Same issue :(
same here
same here, any idea?
I've got the same.
Same Here
Any one already working on this issue? Or any one has an idea to solve this?
@AsadSaleh This is not a critical problem, just a warning for 'maybe there is something wrong in your code', so you can simply ignore this warning by add codes like bellow, and wait someone will fix this warning ...
YellowBox.ignoreWarnings([
'Remote debugger is in a background tab which may cause apps to perform slowly',
'Require cycle: node_modules/rn-fetch-blob/index.js',
'Require cycle: node_modules/react-native/Libraries/Network/fetch.js'
]);
any update on this ?
@wd This is a warning but needs to be dealt with. This has come up with new react-native version (0.57) and requires certain code restructuring in rn-fetch-blob library.
Is anyone working on this?
I also encountered this problem today.
Modify these files can avoid require cycle: IN DIR rn-fetch-blob/polyfill all thease 4 files: Blob.js, Fetch.js, FileReader.js, XMLHttpRequest.js
// import RNFetchBlob from '../index.js' import {NativeModules} from 'react-native'; const RNFetchBlob = NativeModules.RNFetchBlob
Modify these files can avoid require cycle: IN DIR rn-fetch-blob/polyfill all thease 4 files: Blob.js, Fetch.js, FileReader.js, XMLHttpRequest.js
// import RNFetchBlob from '../index.js' import {NativeModules} from 'react-native'; const RNFetchBlob = NativeModules.RNFetchBlob
this problem has resolved, thanks brother
there is going to be a PR for @zhuxianqin fix ???
@zhuxianqin can you please submit a PR with this fix?
@zhuxianqin can you please submit a PR with this fix?
sorry, I don't know how to release github project, I will try to do it in several days
@zhuxianqin can you please submit a PR with this fix?
to develop this project, I need to follow instructions below: https://github.com/joltup/rn-fetch-blob-dev I have to test both on android & IOS Sorry, I think it's better for the original owner to fix it
@zhuxianqin seems that they are not adding it, it sucks man :(
Seems that you know this library a lot, though. Can you help me with something? I created this post https://github.com/joltup/rn-fetch-blob/issues/305
This should be fixed. I'm glad react-native now warns about this but there should have never been cyclic dependencies in the first place.
here it is solved with constructor injection: https://stackoverflow.com/questions/38841469/how-to-fix-this-es6-module-circular-dependency/44226565#44226565
https://github.com/react-native-community/react-native-svg/issues/773
Another way to solve this is to make an interface with a setter and a getter and require the interface instead of the original class. The original file uses the setter and all others use the getter.
interface.js:
let thing = {}
export function getThing () {
return thing
}
export function setThing (thingToSet) {
thing = thingToSet
}
thing.js:
import {setThing} from './interface'
class Thing {}
setThing(Thing)
other files:
import {getThing} from './interface'
const Thing = getThing()
@ThaJay yea man, i receive like 6-7 warning notifications every time i refresh the app, is getting super annoying. Do you have any idea how to apply this interface for this specific case?
Modify these files can avoid require cycle: IN DIR rn-fetch-blob/polyfill all thease 4 files: Blob.js, Fetch.js, FileReader.js, XMLHttpRequest.js
// import RNFetchBlob from '../index.js' import {NativeModules} from 'react-native'; const RNFetchBlob = NativeModules.RNFetchBlob
This did the trick on RN 0.57 This bug should be fixed...
@vitor-veras i have to put the fetch-blob file in my app and edit it then? no other way until they fix this? :/ i don't get it, i assume i don't have to update these files directly from node_modules otherwise it will be over-written whenever i do another npm install... so how should i do it?
That's only a warning from React Native, but it can slowdown the app performance. And yes if you update the package with npm/yarn the fix will go away. There's no proper aproach to this i think, hopefully the dev team fix this soon. There is actually a PR for this #296 .
As mentioned by @alpha0010 in #296 one would encounter problems where RNFetchBlob is called within the files the import is removed from.
@ThaJay would you be able to submit a PR?
Just stupid me, but why are these polyfills even required here? As RN 0.59 comes with a new JavaScriptCore, are these polyfills still necessary? Or is there even a way to DISABLE these polyfills, like a non-polyfilled version of the lib?