Skip to main content
added 146 characters in body
Source Link
mwarren
  • 143
  • 5

I'm trying to use Turf distance and Turf point with Mapbox GL JS.

I've installed @turf/distance from npm which also installs @turf/helpers.

I see that distance has a default export

exports.default = distance;

So my import is as follows:

import distance from '@turf/distance';
import { point } from '@turf/helpers';

point imports as expected, distance is always empty, whatever I try. This should be so simple....

Can anybody put me out of my misery, and tell me how they imported distance?

UPDATE: found the problem

I was reassigning the distance variable - what a noob.

let distance = distance(from, to, options);

I'm trying to use Turf distance and Turf point with Mapbox GL JS.

I've installed @turf/distance from npm which also installs @turf/helpers.

I see that distance has a default export

exports.default = distance;

So my import is as follows:

import distance from '@turf/distance';
import { point } from '@turf/helpers';

point imports as expected, distance is always empty, whatever I try. This should be so simple....

Can anybody put me out of my misery, and tell me how they imported distance?

I'm trying to use Turf distance and Turf point with Mapbox GL JS.

I've installed @turf/distance from npm which also installs @turf/helpers.

I see that distance has a default export

exports.default = distance;

So my import is as follows:

import distance from '@turf/distance';
import { point } from '@turf/helpers';

point imports as expected, distance is always empty, whatever I try. This should be so simple....

Can anybody put me out of my misery, and tell me how they imported distance?

UPDATE: found the problem

I was reassigning the distance variable - what a noob.

let distance = distance(from, to, options);
Source Link
mwarren
  • 143
  • 5

Turfjs default es6 import fails

I'm trying to use Turf distance and Turf point with Mapbox GL JS.

I've installed @turf/distance from npm which also installs @turf/helpers.

I see that distance has a default export

exports.default = distance;

So my import is as follows:

import distance from '@turf/distance';
import { point } from '@turf/helpers';

point imports as expected, distance is always empty, whatever I try. This should be so simple....

Can anybody put me out of my misery, and tell me how they imported distance?