module-deps icon indicating copy to clipboard operation
module-deps copied to clipboard

Unexpected token with ?.

Open xavdid opened this issue 3 years ago • 0 comments

I'm not sure if the problem is here (or in a subpackage, like detective, but I noticed this library tripping over semi-recent ES syntax. I'm not sure what the best fix is - if there's something on my end I can configure with browserify or if there's something in one of the related packages that needs to be updated to support newer syntax.

Either way, thanks a bunch!

Reproduction

t.js:

require("fs");

let o = {};
console.log(o?.a?.b);
$ module-deps t.js

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: Parsing file t.js: Unexpected token (4:14)
    at Deps.parseDeps (.../module-deps/index.js:519:15)
    at getDeps (.../module-deps/index.js:447:44)
    at /module-deps/index.js:430:38
    ...

This was on Node.js 14, where the ?. syntax works as expected:

$ node t.js
undefined

Package Versions

xavdid avatar Jun 29 '21 23:06 xavdid