Open codewithrohit opened 4 years ago
Thanks for reaching out, could you provide a reproduction of this issue? Either through a repo or a tool such as codesandbox?
Hi @prescottprue,
The above mentioned warning is shown on the metro terminal with the latest react-native setup, if you require a repo to reproduce this issue happy to set one up.
[Sat Jul 11 2020 16:27:42.309] WARN Require cycle: node_modules/react-redux-firebase/lib/utils/index.js -> node_modules/react-redux-firebase/lib/utils/events.js -> node_modules/react-redux-firebase/lib/utils/populate.js -> node_modules/react-redux-firebase/lib/utils/index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
[Sat Jul 11 2020 16:27:42.310] WARN Require cycle: node_modules/react-redux-firebase/lib/utils/index.js -> node_modules/react-redux-firebase/lib/utils/events.js -> node_modules/react-redux-firebase/lib/utils/query.js -> node_modules/react-redux-firebase/lib/utils/index.js
I am getting the same warning.
Yeah a repro would be great - I haven't used react-native as much recently
I have exactly same warning. Some part of my code:
// /utils/firebase.js
import firebase from '@react-native-firebase/app';
import '@react-native-firebase/firestore';
import '@react-native-firebase/auth';
import '@react-native-firebase/storage';
import 'react-native-get-random-values';
import { v4 as uuidv4 } from 'uuid';
var config = {
apiKey: "my apiKey",
authDomain: "my authDomain",
databaseURL: "my databaseURL",
projectId: "my projectId",
storageBucket: "my storageBucket",
messagingSenderId: "my messagingSenderId",
appId: "my appId",
measurementId: "my measurementId"
};
if (!firebase.apps.length) {
firebase.initializeApp(config);
}
export { firebase }
//index.js
import 'react-native-gesture-handler';
import React, { Component } from 'react';
import AppRoot from './utils/navigation';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import { createFirestoreInstance } from 'redux-firestore';
import { ReactReduxFirebaseProvider, getFirebase } from 'react-redux-firebase';
import rootReducer from './store/reducers/rootReducer';
import { firebase } from './utils/firebase';
import { MenuProvider } from 'react-native-popup-menu';
const store = createStore(
rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument(getFirebase))
)
);
const rrfProps = {
firebase: firebase.app(),
config: {
userProfile: 'users',
useFirestoreForProfile: true,
},
dispatch: store.dispatch,
createFirestoreInstance
};
export default class App extends Component {
render() {
return (
<Provider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<MenuProvider>
<AppRoot />
</MenuProvider>
</ReactReduxFirebaseProvider>
</Provider>
)
}
}
@xdarkleonx have you tried passing just firebase
instead of firebase.app()
for firebase
prop?
If @indvinoth or anyone else can provide a repro of this that would be much appreciated
I removed .app() and still get this warning Maybe later i will give more code details.
Reposting codesandbox of the issue from this duplicate issue created by @tarunkishore2303
Go to --> node_modules\react-redux-firebase\lib\utils\index.js then, you will find this codes,
"use strict";
.........
Object.defineProperty(exports,"getEventsFromInput",{enumerable:!0,get:function get(){
return _events.getEventsFromInput
}}),
.....
var _filter2=_interopRequireDefault(require("lodash/filter")),
_some2=_interopRequireDefault(require("lodash/some")),
_isEqual2=_interopRequireDefault(require("lodash/isEqual")),
_constant2=_interopRequireDefault(require("lodash/constant")),
_events=require("./events");
...........
remove " _events=require("./events"); '' from var and place above the '' return _events.getEventsFromInput ''
example : var _events=require("./events");
Object.defineProperty(exports,"getEventsFromInput",{enumerable:!0,get:function get(){
var _events=require("./events");
return _events.getEventsFromInput
}}),
var _filter2=_interopRequireDefault(require("lodash/filter")),
_some2=_interopRequireDefault(require("lodash/some")),
_isEqual2=_interopRequireDefault(require("lodash/isEqual")),
_constant2=_interopRequireDefault(require("lodash/constant"));
// _events=require("./events");
Like this. for me it solved require cylce issue
Getting below warning message from yesterday :
Require cycle: node_modules\react-redux-firebase\lib\utils\index.js -> node_modules\react-redux-firebase\lib\utils\events.js -> node_modules\react-redux-firebase\lib\utils\populate.js -> node_modules\react-redux-firebase\lib\utils\index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. [Mon May 25 2020 15:31:54.563] WARN Require cycle: node_modules\react-redux-firebase\lib\utils\index.js -> node_modules\react-redux-firebase\lib\utils\events.js -> node_modules\react-redux-firebase\lib\utils\query.js -> node_modules\react-redux-firebase\lib\utils\index.js
Help me to understand why i am getting this warning ??
as u can notice in those 3 files index.js , populate.js , events.js index ---> require events.js events ---> require populate.js populate ---> require index.js this creates a cylce warning
Getting below warning message from yesterday :
Require cycle: node_modules\react-redux-firebase\lib\utils\index.js -> node_modules\react-redux-firebase\lib\utils\events.js -> node_modules\react-redux-firebase\lib\utils\populate.js -> node_modules\react-redux-firebase\lib\utils\index.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. [Mon May 25 2020 15:31:54.563] WARN Require cycle: node_modules\react-redux-firebase\lib\utils\index.js -> node_modules\react-redux-firebase\lib\utils\events.js -> node_modules\react-redux-firebase\lib\utils\query.js -> node_modules\react-redux-firebase\lib\utils\index.js
Help me to understand why i am getting this warning ??