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

Build development and production ES5 bundles for the JavaScript runtime #3065

Closed
wants to merge 1 commit into from

Conversation

octogonz
Copy link

@octogonz octogonz commented Feb 1, 2021

Work in progress for issue #3032

@octogonz
Copy link
Author

octogonz commented Feb 1, 2021

This is an initial sketch of a fix for #3032. It builds two ES5 bundles, one for development, and one for production. By default the "module" entry point links to the development bundle.

It seems that the "main" entry point must still refer to src/index.js for now, because the ANTLR runtime relies on filesystem APIs that are not available in a web browser. (Your Webpack configuration works around that problem by mapping those modules to "empty", but this is not very clean. A better solution might be to separate the ANTLR APIs with Node.js dependencies to have their own supplementary entry point.)

I can test this and refine it some more. But first I'm wondering how you will publish it. It seems that the version 4.9.1 did not include the dist folder, so perhaps some work is also needed for whatever CI job publishes these NPM relases. (?)

@ericvergnaud
Copy link
Contributor

ericvergnaud commented Feb 1, 2021

Hi,

thanks for this.

Not sure how you relate the main entry point with fs dependency ?

Re publishing, there is no CI per say, rather a script that Ter runs after versioning and testing everything.
We definitely want the dist folder to be published.

@octogonz
Copy link
Author

Not sure how you relate the main entry point with fs dependency ?

The main entry point is for CommonJS consumers, which is typically Node.js -- which /would/ want the fs APIs.

Whereas the module entry point is (generally) for web browsers -- which need a bundle and do NOT have fs.

Thus main and module for now must return two different implementations of ANTLR. But that is not ideal.

@ericvergnaud
Copy link
Contributor

But how does "src/index.js" work when there is no such file?
Also does all this work with npm link?

@ericvergnaud
Copy link
Contributor

btw the javascript CI fails, so you might want to rebase to get the latest changes and see how it goes

@ericvergnaud
Copy link
Contributor

Hey, we have an upcoming TypeScript target, see #4027, so you probably want to close this ?

@octogonz
Copy link
Author

octogonz commented Jun 5, 2023

Closing since #3032 was closed.

@octogonz octogonz closed this Jun 5, 2023
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

Successfully merging this pull request may close these issues.

2 participants