browserify / browserify/module-deps

Unexpected token with ?.

Open
#166 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
208
Forks
102
PR merge metrics
No merged PRs in 30d

Description

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`:

```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

* acorn@7.1.0
* acorn-node@1.8.2
* detective@5.2.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.