Skip to content
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

[WIP-HELP-WANTED] feat: use arg parsing instead of object-oriented flag setting #1738

Closed
wants to merge 1 commit into from

Conversation

evenstensberg
Copy link
Member

What kind of change does this PR introduce?

Uses functions to set flags rather than to check existence

Did you add tests for your changes?
Not yet
If relevant, did you update the documentation?
No
Summary
WIP

Does this PR introduce a breaking change?

No

Other information

Needs help

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

What is use case? I can't understand what you try to achive

console.log("Cannot instantiate plugin " + name + ". (" + path + ")");
throw e;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

We don't need it, plugin only for webpack.conifg.js configuration, trying to load enhanced-resolve break yarn PnP

let path;
try {
const resolve = require("enhanced-resolve");
path = resolve.sync(process.cwd(), name);
Copy link
Member

Choose a reason for hiding this comment

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

You don't need this, because you have require.resolve

const loadUtils = require("loader-utils");
let args;
try {
const p = name && name.indexOf("?");
Copy link
Member

Choose a reason for hiding this comment

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

Plugins can't have ? in name

ifArg(name, function (bool) {
if (bool === true) options[optionName || name] = true;
else if (bool === false) options[optionName || name] = false;
});
Copy link
Member

Choose a reason for hiding this comment

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

Very misleading, we wee need this - optionName || name?

finalize && finalize();
}

ifArgPair(name, fn, init, finalize) {
Copy link
Member

Choose a reason for hiding this comment

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

Can't understand code

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

Successfully merging this pull request may close these issues.

None yet

3 participants