Has Node.js v12.0.0 broken something to do with using esm in the REPL?
$ npm install geodesy esm
$ nvm use 11.14.0
Now using node v11.14.0 (npm v6.7.0)
$ node -r esm
> import LatLon from 'geodesy/latlon-spherical';
undefined
> d = new LatLon(52, 0).distanceTo(new LatLon(48, 2));
467138.7758206903
>
$
$ nvm use 12.0.0
Now using node v12.0.0 (npm v6.9.0)
$ node -r esm
Welcome to Node.js v12.0.0.
Type ".help" for more information.
> import LatLon from 'geodesy/latlon-spherical';
Thrown:
TypeError: Cannot read property 'exports' of undefined
at repl:1
at repl:1
at Script.runInThisContext (vm.js:123:20)
at REPLServer.defaultEval (repl.js:358:29)
at bound (domain.js:415:14)
at REPLServer.runBound [as eval] (domain.js:428:12)
at REPLServer.onLine (repl.js:665:10)
>
$
Or is there something we should be doing differently now?
Has Node.js v12.0.0 broken something to do with using
esm
in the REPL?Or is there something we should be doing differently now?
(This is with
esm
v3.2.22).