schoero / swissqrbill

Swiss QR Bill generation in Node.js and browsers
MIT License
156 stars 29 forks source link

SyntaxError: Unexpected token '.' return ibanArray?.join(" ") ?? iban; #346

Closed KylianBoss closed 2 years ago

KylianBoss commented 2 years ago

Hi,

I've just read the documentation and download your module in my project (thanks for the job !) But when I try to run the code just after adding your module and integrate to my code I've somes errors.

.../node_modules/swissqrbill/lib/node/esm/shared/utils.js:26
    return ibanArray?.join(" ") ?? iban;
                     ^

SyntaxError: Unexpected token '.'

I tried to correct that but I get other errors after and I don't want to break your code. Are you aware of this kind of problem in your version 3 ?

I've no error in my code before, I'm using Node js version 12.18.4 in ESM

Thanks for your help.

schoero commented 2 years ago

Hi

The issue is that Node.js v12 does not support the optional chaining feature, which throws the error. Upgrading to Node.js v14 would solve the issue for you. But to solve it for everyone else, I am currently testing if I can transpile the ES versions down to ES6. I will get back to you soon.

schoero commented 2 years ago

SwissQRBill v3.0.1 which fixes this issue is now released on npm.

KylianBoss commented 2 years ago

Hi,

Thanks for your quick response ! I've updated my version of Node to 14 and it's working fine thanks again.

Thanks a lot for your job !