Open deathcap opened 8 years ago
+1
Yes, please! The default main breaks commonjs modules used in browser (fs
not available).
Anything missing here? Any way to help?
It would be great to have this, making people stub out fs
in their webpack config is a nuisance.
For now it seems I can install the forked version, like this:
yarn add -D jison@https://github.com/deathcap/jison.git#modulemain
Allows using the
--moduleMain
argument with the command-line interface, to define an alternateexports.main
implementation.Without this change, it is only possible (as far as I can tell) to set
moduleMain
through the module API but not the CLI. (You can also specify%option moduleMain
in the grammar jison input file, but it generates invalid JavaScript then - only appears to be possible set it to "true", but a function is required).Tested this change with
make test
, all pass