I recently added the antlr4ng
(version 3.0.4
) package to my packages.json
in my Typescript project (nodejs
version 20.11.1
). It works as expected except if it is used within a jest
test, in which case I get this error at runtime:
SyntaxError: /Users/XXX/node_modules/.pnpm/[email protected][email protected]/node_modules/antlr4ng/dist/index.cjs: Static class blocks are not enabled. Please add `@babel/plugin-transform-class-static-block` to your configuration.
As suggested by the error message, I added the package @babel/plugin-transform-class-static-block
(version 7.24.4
) to the babel
test plugins
, but this did not resolve the error.
Please forgive the overly specific nature of this question, but I’m at a loss as to how to fix this problem and posting here is my last hope. Thanks!