Esm: Static getter in a class results in SyntaxError with esm 3.2.23

Created on 16 May 2019  路  9Comments  路  Source: standard-things/esm

The following can no longer be loaded with the 3.2.23 release:

export class Foo
{
    static get bar()
    {
        return "Foo";
    }
}

If you try you get:

static get bar()
               ^

SyntaxError: Invalid or unexpected token
    at Object.Module._extensions..js (module.js:664:10)

It works with 3.2.22.

bug

Most helpful comment

esm v3.2.24 is released 馃帀

All 9 comments

Have the same problem

I'm having a similar issue, works with 3.2.22 but not 3.2.23:

node_modules/puppeteer/lib/Page.js:44
    static async create(client, target, ignoreHTTPSErrors, defaultViewport, screenshotTaskQueue) {
                 ^

  SyntaxError: Invalid or unexpected token

Yep, super sorry about that folks. Updated parsing support and missed smth. Will have it fixed in the next few hours.

thanks guys for taking the time to report! looks like a regression.

@jdalton the following fail with v3.2.23.:

class Foo {
  static get bar() {}
  static set bar(val) {}
  static async afunc() {}
  static *gfunc() {}
  static async *agfunc() {}
}

@jdalton uups, same time. 馃槃 btw, not sure if you noticed. the git release tags are tagged as 3.2.33 as supposed to 3.2.23.

esm v3.2.24 is released 馃帀

Thanks for the fix @jdalton! I'm noticing some cases are still having trouble however.

$ node -r esm
> require('node-fetch')
/Users/brian.beck/Projects/node_modules/node-fetch/lib/index.js:899
    [Symbol.iterator]() {
                  ^

SyntaxError: Invalid or unexpected token

(that [Symbol.iterator]() method is on a class)

works fine on 3.2.22 and without esm!

I'll throw that into the test mix too : )

Ditto to @exogen comment with the same error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Pokute picture Pokute  路  3Comments

janusqa picture janusqa  路  3Comments

MVSICA-FICTA picture MVSICA-FICTA  路  3Comments

mAAdhaTTah picture mAAdhaTTah  路  3Comments

greggb picture greggb  路  3Comments