wallabyjs / quokka

Repository for Quokka.js questions and issues
https://quokkajs.com
1.18k stars 31 forks source link

Quokka is fails to parse the `static` keyword used to define a static field in a class #869

Closed accuser closed 1 year ago

accuser commented 1 year ago

Issue description or question

Is this issue related to Quokka not outputting the expected results of your code?: Yes

The code runs under NodeJS as expected.

Sample code

class Person {
    static people = [];

    constructor(firstName, lastName) {
        this.firstName = firstName;
        this.lastName = lastName;
        Person.people.push(this);
    }
}

Sample repository link

If the issue can not be reproduced just using the quokka file above (for example because it requires/imports some files from your project), please create a small repository where the issue can be reproduced.

Quokka.js Console Output

Unexpected token = 
  ​​​​​at ​​​​​​​​Object.compileFunction​​​ ​vm.js:406​

Code editor version

Visual Studio Code v1.77.3

OS name and version

Windows 10.0.19045

smcenlly commented 1 year ago

The latest version of Quokka supports static keyword used as you described. We added support for it a few weeks ago.

image

Can you please tell us what version of Quokka you are using?

If you are using the latest version of Quokka, can you also please provide us with the Quokka result of console.log(process.version) (without your Person class) so we can see which version of node Quokka is using?

accuser commented 1 year ago

I'm using Quokka v1.0.531. console.log(process.version) outputs v10.19.0.

ArtemGovorov commented 1 year ago

Thanks for checking. It looks like your installed node version that Quokka is using (one from your PATH) is too old and doesn't support static. You may either update your default node version, or specify a path to a more recent installed node version in Quokka settings.