Optional chaining not working in Node 14 LTS?

Viewed 343

For some reason optional chaining isn't working even though I'm using the Node 14 LTS.

../node_modules/babel-core/lib/transformation/file/index.js:558
      throw err;
      ^

Unexpected token (666:41)
  664 |       await finished(createReadStream().pipe(createWriteStream(filePath)));
  665 | 
> 666 |       const url = await context?.getUser(id)

Why might this be happening?

I noticed babel was in the error, here are all my babel dependencies:

    "@babel/helper-hoist-variables": "^7.14.5",
    "babel-cli": "6.23.0",
    "babel-eslint": "10.1.0",
    "babel-plugin-transform-async-to-module-method": "6.22.0",
    "babel-plugin-transform-es2015-modules-commonjs": "6.23.0",
    "babel-plugin-transform-flow-strip-types": "6.22.0",
    "babel-plugin-transform-object-rest-spread": "6.23.0",
    "babel-preset-latest": "6.22.0",

Start script:

"start": "nodemon ./src/index.js --exec babel-node --watch ./src

Unsure what --exec babel-node means.

0 Answers
Related