Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit antlr4 dependency once they fix their packaging #132

Open
jharris4 opened this issue May 10, 2023 · 0 comments
Open

Revisit antlr4 dependency once they fix their packaging #132

jharris4 opened this issue May 10, 2023 · 0 comments

Comments

@jharris4
Copy link
Collaborator

The antlr4 package used by this project for the cypher grammar has several issues with its packaging.

This issue is to track the current state of those issues to facilitate any future work to address them.

We are currently using version 4.10.1 which provides all source files with nothing but es6 exports, but unfortunately that doesn't support commonjs, and also doesn't provide separate entry points for consumption by node vs browser.

This is why the current @neo4j/antlr-browser package exists, as a hack to remove the node specific code so that we can use it for the web.

The newer latest version is 4.12.0 in which they made an attempt to provide separate entry points for node vs browser, but unfortunately they decided to use webpack to bundle the code for both, resulting in massive bloat to the dependency size (>100KB !) and also prevents any tree-shaking optimizations since they ship everything as 1 file.

A couple of PRs were made to antlr4 to address this (antlr/antlr4#4193 and antlr/antlr4#4199) but unfortunately the antlr4 maintainers didn't accept it.

Someone else did make a PR (antlr/antlr4#4217) that got merged to add yet another webpack bundle output which may help us somewhat, so we should try it once it's released (probably in 4.12.1) and evaluate if it's worth upgrading to despite the fact that it will increase our bundle size by >100KB.

Also relevant, lots of people are hitting similar problems to the ones we've faced, as shown in this issue: antlr/antlr4#4218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant