You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ node foo.js
import { point } from "@turf/helpers";
^^^^^
SyntaxError: The requested module '@turf/helpers' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from '@turf/helpers';
const { point } = pkg;
Replacing "@turf/helpers" with "@turf/helpers/dist/es/index.js" the same error message. Now, if I add "type": "module" to node_modules/@turf/helpers/package.json:
$ node foo.js
[Function: point]
However, if I change the import back to "@turf/helpers":
$ node foo.js
file:///Users/jamesdiacono/Code/monorepo/pkg/app/foo.js:1
import { point } from "@turf/helpers";
^^^^^
SyntaxError: The requested module '@turf/helpers' does not provide an export named 'point'
at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:137:5)
at async Loader.import (internal/modules/esm/loader.js:165:24)
at async Object.loadESM (internal/process/esm_loader.js:68:5)
It appears that if package.json specifies "type": "module", then the "module" property is ignored! More discussion at nodejs/modules#432.
The text was updated successfully, but these errors were encountered:
Versions
Replacing
"@turf/helpers"
with"@turf/helpers/dist/es/index.js"
the same error message. Now, if I add"type": "module"
tonode_modules/@turf/helpers/package.json
:However, if I change the import back to
"@turf/helpers"
:It appears that if package.json specifies
"type": "module"
, then the"module"
property is ignored! More discussion at nodejs/modules#432.The text was updated successfully, but these errors were encountered: