-
Notifications
You must be signed in to change notification settings - Fork 450
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
Pass moduleMain option to generator #316
base: master
Are you sure you want to change the base?
Conversation
+1 |
Yes, please! The default main breaks commonjs modules used in browser ( |
Anything missing here? Any way to help? |
@@ -145,6 +145,9 @@ cli.generateParserString = function generateParserString(opts, grammar) { | |||
if (opts.moduleName) { | |||
settings.moduleName = opts.moduleName; | |||
} | |||
if (opts.moduleMain) { | |||
settings.moduleMain = opts.moduleMain; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No parsing necessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just a string of source code, isn't it?
It would be great to have this, making people stub out |
For now it seems I can install the forked version, like this:
|
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