Closed rqbazan closed 4 years ago
static fields are not supported in node.js v10.16.0. you can verify without using esm
:
node -e "class A { static a = 1 }; console.log(A.a);"
[eval]:1
class A { static a = 1 }; console.log(A.a);
^
SyntaxError: Unexpected token =
at new Script (vm.js:83:7)
at createScript (vm.js:277:10)
at Object.runInThisContext (vm.js:329:10)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at evalScript (internal/bootstrap/node.js:590:27)
at startup (internal/bootstrap/node.js:265:9)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
though it works with e.g. node.js v12+
@dnalborczyk thanks for the clarification
How to reproduce?
Environment
Workaround