standard-things / esm

Tomorrow's ECMAScript modules today!
Other
5.26k stars 146 forks source link

Problem with Node.js v12.0.0 REPL? #792

Closed chrisveness closed 5 years ago

chrisveness commented 5 years ago

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?

(This is with esm v3.2.22).

willxy commented 5 years ago

I'm getting this error as well, from importing at the REPL with 12.0.0 and 12.1.0.

jdalton commented 5 years ago

Yep. No need for others to confirm. I've been meaning to move to a more thorough hook for the REPL.

I'm guessing it's time :)

boneskull commented 5 years ago

tests are also failing in Node.js v12 because there's no binary for sleep available (darwin)