Closed sulkaharo closed 5 years ago
I am experiencing similar syntax problems with 3.2.23 (3.2.22 is ok) running on node 10.15, recent syntax errors reported per #804, too:
[formatSymbol](formatter, context) {
^
SyntaxError: Invalid or unexpected token
Looks same here with Symbol.iterator (works perfectly with previous release 3.2.22)
/private/node_modules/node-fetch/lib/index.js:908
[Symbol.iterator]() {
^
SyntaxError: Invalid or unexpected token
at Module._extensions..js (internal/modules/cjs/loader.js:704:10)
at Object.require.extensions.(anonymous function) (/private/node_modules/babel-register/lib/node.js:152:7)
Moving to #804.
The JOSE library seems to use a lot of the latest ES syntaxes introduced in Node 12: https://github.com/panva/jose Using the library in a project with Node 12.2.0 and ESM, when loading the library, this error is produced and the application fails to start.
You can easily reproduce this:
Paste this to index.js:
then run both
node index.js
andnode -r esm index.js
and you'll get the error when ESM is used.