Including d3 in projects related to response, raises a UnableToResolveError: the module `child_process` cannot be resolved

I have a jet project in which I use ART + D3. Everything works fine when working with the d3-shaped and d3-scale. (using mainly d3-shape.area ()) now I want to use d3.line ()

But when adding import * as d3 from 'd3';

I get the following error

Transforming modules  β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–‘  99.6% (544/545)...(node:11758) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2320): UnableToResolveError: Unable to resolve module `child_process` from `/[myproject]/node_modules/xmlhttprequest/lib/XMLHttpRequest.js`: Module does not exist in the module map or in these directories:
  /[myproject]/node_modules

As far as I can tell, the problem is that you cannot use node modules in reaction-native https://github.com/facebook/react-native/issues/7170

And, the dependency chain d3 -> d3-request -> xmlHttpRequest -> child_process

How can I remove a dependency or get around it? As far as I can tell, I don't need to use any functions related to xmlHttpRequest.

. json

"dependencies": {
  "art": "^0.10.1",
  "d3": "^4.10.2",
  "d3-scale": "^1.0.6",
  "d3-shape": "^1.2.0",
  "mobx": "^3.1.10",
  "mobx-persist": "^0.3.3",
  "mobx-react": "^4.1.8",
  "moment": "^2.18.1",
  "react": "~15.4.2",
  "react-addons-test-utils": "^15.6.0",
  "react-dom": "~15.4.1",
  "react-mixin": "^3.0.5",
  "react-native": "^0.42.3",
  "react-native-check-box": "ssh://git@github.com:jav/react-native-check-box",
  "react-native-datepicker": "^1.5.1",
  "react-native-menu": "^0.21.0",
  "react-native-radio-buttons": "^1.0.0",
  "react-navigation": "^1.0.0-beta.11",
  "react-timer-mixin": "^0.13.3",
  "url": "^0.11.0",
  "uuid": "^3.0.1"
},
+4

Source: https://habr.com/ru/post/1685995/


All Articles