Skip to content

Require cycle warning when used with React Native #27

@canxerian

Description

@canxerian

When importing and using the createClient function in a React Native project this warning is logged to the console:

WARN  Require cycle: node_modules\whatwg-fetch\dist\fetch.umd.js -> node_modules\react-native\Libraries\Network\fetch.js -> node_modules\whatwg-fetch\dist\fetch.umd.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
AppScreen@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomequotes&modulesOnly=false&runModule=true:109773:36
RCTView
View
RCTView
View
AppContainer@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomequotes&modulesOnly=false&runModule=true:76752:36
AwesomeQuotes(RootComponent)@http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false&app=com.awesomequotes&modulesOnly=false&runModule=true:83145:28
 WARN  Require cycle: node_modules\react-native\Libraries\Network\fetch.js -> node_modules\react-native\Libraries\Network\fetch.js

Repro:

  1. Create a React Native project (guide here: https://reactnative.dev/docs/environment-setup)
  2. Modify App.js and add
import { createClient } from 'pexels';
async componentDidMount() {
    const client = createClient(API_KEY);
    const res = await client.videos.search({ query: "Nature", size: "small", orientation: "landscape", per_page: NumVideos });
 }

Environment: React Native running on Android emulator, Android 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions