zaach / jison

Bison in JavaScript.
http://jison.org
4.34k stars 448 forks source link

Pass moduleMain option to generator #316

Open deathcap opened 8 years ago

deathcap commented 8 years ago

Allows using the --moduleMain argument with the command-line interface, to define an alternate exports.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

illuxio commented 8 years ago

+1

ahamid commented 7 years ago

Yes, please! The default main breaks commonjs modules used in browser (fs not available).

ftes commented 5 years ago

Anything missing here? Any way to help?

dobesv commented 4 years ago

It would be great to have this, making people stub out fs in their webpack config is a nuisance.

dobesv commented 4 years ago

For now it seems I can install the forked version, like this:

yarn add -D jison@https://github.com/deathcap/jison.git#modulemain