This should be straigh forward.
yarn add turf
and then - according to documentation:
// Import your module of interest
var collect = require('@turf/collect');
// or in ES6
import collect from '@turf/collect';
But, when I try any of these, it does not work. I get
Unable to resolve module
@turf/collect
.
When I check the node_modules
folder, I see that turf
installed properly (at least there are folders and there is something in them).
I tried this in a react-native
project:
watchman watch-del-all
node_modules
and freshly yarn install
yarn start --reset-cache
The namespace changed.
Turf must be installed with @turf/turf
, i.e. yarn add @turf/turf