Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require cycle warning when used with React Native #27

Open
canxerian opened this issue Jan 14, 2022 · 1 comment
Open

Require cycle warning when used with React Native #27

canxerian opened this issue Jan 14, 2022 · 1 comment

Comments

@canxerian
Copy link

canxerian commented Jan 14, 2022

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.

@Pondake
Copy link

Pondake commented Feb 16, 2023

Did you manage to find a solution? I have the same problem with Vite4 & Vue3 where I can't use "require", rendering this package useless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants