Can import @turf
packages as "npm imports" but not as "node imports"
#1558
-
This works: import { center } from "npm:@turf/center";
import { points } from "npm:@turf/turf";
const features = points([
[-97.522259, 35.4691],
[-97.502754, 35.463455],
[-97.508269, 35.463245],
]);
const p = center(features); But I can't use a "node import" to import from import { center } from "@turf/center"; Displays this error message in the page:
Similarly, See https://turfjs.org/docs/api/center and https://www.npmjs.com/@turf/center |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The problem is likely that turf (in https://cdn.jsdelivr.net/npm/@turf/[email protected]/dist/esm/index.js https://cdn.jsdelivr.net/npm/[email protected]/index.js Framework |
Beta Was this translation helpful? Give feedback.
-
I have confirmed that this issue was fixed in Turf.js 7.0.0 and that currently imports of both import * as turf from "npm:@turf/turf"; import * as turf from "@turf/turf"; We still recommend using npm imports over Node imports as npm imports do not require you to explicitly manage dependencies yourself. |
Beta Was this translation helpful? Give feedback.
I have confirmed that this issue was fixed in Turf.js 7.0.0 and that currently imports of both
@turf/turf
andnpm:@turf/turf
work out of the box in recent versions of Framework (1.6.0+).We still recommend using npm imports over Node imports as npm imports do not require you to explicitly manage dependencies yourself.