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
$ npm install d3-dsv
$ echo "import { csvFormat } from 'd3-dsv'" > exp.mjs
$ node --experimental-modules exp.mjs
(node:29364) ExperimentalWarning: The ESM module loader is experimental.
SyntaxError: The requested module does not provide an export named 'csvFormat'
at ModuleJob._instantiate (internal/loader/ModuleJob.js:84:17)
at <anonymous>
$ node -r babel-register exp.mjs
exp.mjs:9
_d3Dsv2.default.csvFormat([]);
^
TypeError: Cannot read property 'csvFormat' of undefined
at Object.<anonymous> (exp.mjs:2:4)
at Module._compile (module.js:660:30)
at loader (node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3
Alternatively, importing the whole module fails and using property notation with --experimental-modules:
import*asd3from'd3-dsv';d3.csvFormat([]);
$ node --experimental-modules exp.mjs
(node:31199) ExperimentalWarning: The ESM module loader is experimental.
TypeError: d3.csvFormat is not a function
at exp.mjs:2:4
at ModuleJob.run (internal/loader/ModuleJob.js:96:14)
at <anonymous>
The text was updated successfully, but these errors were encountered:
However, you’ll need an environment that supports the module entry in package.json (I recommend @ std/esm). (An environment that supports interoperability by importing from a CommonJS bundle would also work, but is a bit silly given that d3-dsv is authored in ES modules.)
I'm trying to use d3-dsv in a script run with --experimental-modules. When importing one of the symbols that d3-dsv exports from imported modules, I get:
This works with Babel:
A workaround is to import everything...
...but that's not backwards compatible
Alternatively, importing the whole module fails and using property notation with --experimental-modules:
The text was updated successfully, but these errors were encountered: