es-check
es-check copied to clipboard
Static initialization blocks cause SyntaxError
With this input file
class App {
static {
console.log("hi");
}
}
es-check 9.5.0 fails with
$ pnpm es-check checkBrowser x.js --browserslistQuery="chrome 111"
info: ES-Check: checking 1 file...
error: ES-Check: there were 1 ES version matching errors.
info:
ES-Check Error:
----
· erroring file: x.js at x.js:2:11
· error: SyntaxError: Unexpected token (2:11)
· see the printed err.stack below for context
----
SyntaxError: Unexpected token (2:11)
at pp$4.raise (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:3737:15)
at pp$9.unexpected (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:776:10)
at pp$9.expect (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:770:28)
at pp$5.parseMethod (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:3488:10)
at pp$8.parseClassMethod (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:1623:37)
at pp$8.parseClassElement (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:1581:12)
at pp$8.parseClass (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:1499:26)
at pp$8.parseStatement (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:965:19)
at pp$8.parseTopLevel (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:833:23)
at Parser.parse (node_modules/.pnpm/[email protected]/node_modules/acorn/dist/acorn.js:602:17)
but they are supported with Chrome 111: https://caniuse.com/mdn-javascript_classes_static_initialization_blocks