d3 / d3-interpolate

Interpolate numbers, colors, strings, arrays, objects, whatever!

Home Page:https://d3js.org/d3-interpolate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Require cycle: `value.js` -> `object.js` -> `value.js`

mrousavy opened this issue · comments

Hey! I'm getting the same require cycle again as mentioned in #97, I believe a change has overridden those fixes.

 WARN  Require cycle: node_modules/d3-interpolate/src/value.js -> node_modules/d3-interpolate/src/object.js -> node_modules/d3-interpolate/src/value.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle. 

This is not an error. Circular imports are allowed in ES modules.

I never said it was an error, I'm just reporting it because it "can result in uninitialized values".
Looks like here this can't be the case, but the warning is annoying nonetheless.

This can cause issues when using react-native, breaking end-to-end tests and strict environments. For other react-native using the following code may prevent log boxes from showing up in UI when these warnings occur until the library is updated with a fix (although #97 and #99 indicate that it's probably not high on the priority list). Warnings will still show up in metro logs.

// Add to your root index.js file.
import { LogBox } from 'react-native'

LogBox.ignoreLogs([
  // See https://github.com/d3/d3-interpolate/issues/97 and https://github.com/d3/d3-interpolate/issues/99.
  'Require cycle: node_modules/d3-interpolate/src/value.js -> node_modules/d3-interpolate/src/array.js -> node_modules/d3-interpolate/src/value.js\n\nRequire cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.',
  'Require cycle: node_modules/d3-interpolate/src/value.js -> node_modules/d3-interpolate/src/object.js -> node_modules/d3-interpolate/src/value.js\n\nRequire cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.',
])