I am trying to use webpack with antlr 4 javascript target. I am following this document. https://github.com/antlr/antlr4/blob/master/doc/javascript-target.md
If I understand correctly , webpack will merge all the files from antlr4 javascript runtime librarty and the generated files (Lexer.js, Listener.js and Parser.js) in one single file. I need to include only this one file in my html.
I don't understand this part of the document where it's asking to exclude node.js module. Can someone please explain why this line is needed?
In the
webpack.config
file, exclude node.js only modules using:node: { module: "empty", net: "empty", fs: "empty" }
I also don't have any custom listener or visitor. Can I ignore these steps. I am not creating any index.js file with entry point to my parsing code.
- write your parse tree handling code by providing your custom listener or visitor, and associated code, using 'require' to load antlr.
- create an index.js file with the entry point to your parsing code (or several if required).**