gre / gl-react

gl-react – React library to write and compose WebGL shaders

Home Page:https://gl-react-cookbook.surge.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Require cycle: gl-react/lib/Bus.js -> gl-react/lib/Node.js -> gl-react/lib/Bus.js

serhiipalash opened this issue · comments

Hi @gre !

There is an issue with latest Metro bundler for React Native - it logs warning of Require cycle for all node_modules packages

facebook/metro#287

This leads to very slow performance during development in Expo project

expo/expo#2578

Your gl-react package also have such warning because of

Node.js -> helpers/invariantNoDependentsLoop.js -> Node.js

screen shot 2018-11-04 at 12 01 53 pm

Bus.js imports Node.js that imports Bus.js

screen shot 2018-11-04 at 12 07 54 pm

Can you please restructure the code to remove this cycle?
I would do it by myself but your code is too complex so I can refactor it and don't break anything.

Steps to reproduce:

npm i -g expo-cli
expo init test-require-cycle
cd test-require-cycle
npm install -S gl-react

than in App.js import gl-react

screen shot 2018-11-04 at 12 04 52 pm

and start the project

npm run ios

You'll see warnings in Metro logs.

P.S. Here is the same issue fix in react-native-gesture-handler package
https://github.com/kmagiera/react-native-gesture-handler/pull/323/files

I don't think there is this problem anymore?

I have the same problem, I don't know how to solve it

Require cycle: node_modules\gl-react\lib\Bus.js -> node_modules\gl-react\lib\Node.js -> node_modules\gl-react\lib\Bus.j
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
Require cycle: node_modules\gl-react\lib\Node.js -> node_modules\gl-react\lib\helpers\invariantNoDependentsLoop.js -> node_modules\gl-react\lib\Node.js
Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.

appears in the chrome browser when debug mode is active

have this problem

Same problem even though chrome debugger is off

Hi, this issue is still active on version 5.2.0. Is there any fix for this?