Optional chaining operator gives SyntaxError when building my application to Heroku but works on my machine

I am using the optional chaining operator in my application, for instance: (checks if optionalField exists, then do something with it) The above code works perfectly on my machine but it gives me an error when I try to build this code on Heroku. Here is what the logs say: Does anyone know why is that? I suspect I should compile the code first using Babel and then deploy to Heroku? Is it even related to Babel? Answer Does anyone know why is that? Locally you’re using a recent version of Node.js that supports the optional chaining operator. Apparently Heroku

How to set env in package.json which is used within .bablerc

I am trying to run Jest tests as part of a script before I then run webpack, like this. Jest only works with compiled code, so I had set my .babelrc to the following, which worked, however then it transpiled all my code in webpack which I didn’t want, in development mode I want to leave the JavaScript un-transpiled so I can work with it without it being obfuscated. Instead I want to run Jest by calling ‘npm run test’ which then I can specify only that script transpiles the code and then webpack runs without transpiling, I was hoping