CryptoJS does not work in pre-request script

Simple script:
const​ hash = CryptoJS.HmacSHA256(‘message’, ‘secret’);
console.log(‘hash:’ + hash);

What I see from console is:
SyntaxError: Invalid or unexpected token

Version 7.25.2 for Linux

What should I do to make it work?

Hey @rvitalik34

Welcome to the Postman community!! :trophy:

I did get the same error message when I copied your snippet, might be just the forum syntax weirdness.

I went over to the documentation and copied the same encryption method line from here:

https://cryptojs.gitbook.io/docs/#hmac

That seemed to work for me, could you give it a go please?