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

refactor: 💡 remove --plugin flag #1571

Merged
merged 2 commits into from
May 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/webpack-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Options
--silent Disable any output that webpack makes
--help Outputs list of supported flags
-o, --output string Output location of the file generated by webpack
--plugin string Load a given plugin
-t, --target string Sets the build target
-w, --watch Watch for files changes
-h, --hot Enables Hot Module Replacement
Expand Down
44 changes: 0 additions & 44 deletions packages/webpack-cli/lib/groups/AdvancedGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,6 @@ class AdvancedGroup extends GroupHelper {
constructor(options) {
super(options);
}
// TODO: fixme. This function is requiring modules that are not installed
// loadPlugin(name) {
// const loadUtils = require('loader-utils');
// let args;
// try {
// const p = name && name.indexOf('?');
// if (p > -1) {
// args = loadUtils.parseQuery(name.substring(p));
// name = name.substring(0, p);
// }
// } catch (e) {
// logger.error('Invalid plugin arguments ' + name + ' (' + e + ').');
// process.exit(-1); // eslint-disable-line
// }
//
// let path;
// try {
// const resolve = require('enhanced-resolve');
// path = resolve.sync(process.cwd(), name);
// } catch (e) {
// logger.error('Cannot resolve plugin ' + name + '.');
// process.exit(-1); // eslint-disable-line
// }
// let Plugin;
// try {
// Plugin = require(path);
// } catch (e) {
// logger.error('Cannot load plugin ' + name + '. (' + path + ')');
// throw e;
// }
// try {
// return new Plugin(args);
// } catch (e) {
// logger.error('Cannot instantiate plugin ' + name + '. (' + path + ')');
// throw e;
// }
// }
resolveOptions() {
const {
args,
Expand All @@ -66,13 +29,6 @@ class AdvancedGroup extends GroupHelper {
// options.plugins = [prefetchVal];
}
}
if (args.plugin) {
if (options && options.plugins) {
options.plugins.unshift(this.loadPlugin(args.plugin));
} else {
options.plugins = [this.loadPlugin(args.plugin)];
}
}
if (args.target) {
options.target = args.target;
}
Expand Down
8 changes: 0 additions & 8 deletions packages/webpack-cli/lib/utils/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,6 @@ module.exports = {
description: 'Output location of the file generated by webpack e.g. ./dist/',
link: 'https://webpack.js.org/concepts/#output',
},
{
name: 'plugin',
usage: '--plugin <pluginName>',
group: ADVANCED_GROUP,
type: String,
description: 'Load a given plugin e.g. HtmlWebpackPlugin',
link: 'https://webpack.js.org/plugins/',
},
{
name: 'target',
usage: '--target <value>',
Expand Down