Skip to content

Pass moduleMain option to generator#316

Open
deathcap wants to merge 1 commit into
zaach:masterfrom
deathcap:modulemain
Open

Pass moduleMain option to generator#316
deathcap wants to merge 1 commit into
zaach:masterfrom
deathcap:modulemain

Conversation

@deathcap

Copy link
Copy Markdown

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

illuxio commented Feb 10, 2016

Copy link
Copy Markdown

+1

@ahamid

ahamid commented Jan 11, 2017

Copy link
Copy Markdown

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

@ftes

ftes commented Aug 28, 2018

Copy link
Copy Markdown

Anything missing here? Any way to help?

Comment thread lib/cli.js
settings.moduleName = opts.moduleName;
}
if (opts.moduleMain) {
settings.moduleMain = opts.moduleMain;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No parsing necessary here?

Copy link
Copy Markdown

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?

@dobesv

dobesv commented Jan 28, 2020

Copy link
Copy Markdown

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

@dobesv

dobesv commented Jan 28, 2020

Copy link
Copy Markdown

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants