Closed chungchi300 closed 5 years ago
Hi @chungchi300!
We support parsing class fields. However, the Node version you use must support them.
I mean does it support ESnext Class Fields? The class fields proposal allows properties to be initialized at the top of a class:
class MyClass {
a = 1;
b = 2;
c = 3;
}
The esm
loader supports whatever functionality native Node does. You can get class fields in Node 12 or --harmony
I believe.
@chungchi300 could you verify your node version?
either run node --version
in the terminal, or check process.versions.node
in your node app. if it's not at least v12.0, you have to either run node.js with the --harmony
flag, as @jdalton suggested, or use a transpiler, like Babel.
if your node version is v12.x, and you are still running into this issue, could you provide some repro steps, or better, create a small repository?
https://github.com/tc39/proposal-class-fields