I followed the language pack example to build my own language pack. However, instead of rollup I want to use webpack to build and bundle the npm package. Is there any example of how to do this? Specifically, what would the webpack coinfig look like?
I don’t have experience using webpack for distribution like this (solely for bundling applications) but if you must use webpack you have a few options:
- Run the lezer generate prior to your webpack build process (to ensure you can import it in your bundle) e.g. something like
$ lezer-generator parser/yaml.grammar -o parser/parse && webpack
- Build or find a webpack plugin that can do something similar to the official
rollup plugin
(which just builds the grammar within your build process)
For the purpose of producing a library, I personally think using rollup
is going to be easier. You can always bundle your application with webpack
and just produce a final prod bundle with rollup.
Thanks, I will follow approach 1