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

feature(defaults): remove entry and output.path validation #217

Merged
merged 4 commits into from Dec 16, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 0 additions & 47 deletions bin/convert-argv.js
Expand Up @@ -554,35 +554,6 @@ module.exports = function(yargs, argv, convertOptions) {

mapArgToBoolean("profile");

if (noOutputFilenameDefined) {
ensureObject(options, "output");
if (convertOptions && convertOptions.outputFilename) {
options.output.path = path.resolve(
path.dirname(convertOptions.outputFilename)
);
options.output.filename = path.basename(convertOptions.outputFilename);
} else if (argv._.length > 0) {
options.output.filename = argv._.pop();
options.output.path = path.resolve(
path.dirname(options.output.filename)
);
options.output.filename = path.basename(options.output.filename);
} else if (configFileLoaded) {
throw new Error(
"'output.filename' is required, either in config file or as --output-filename"
);
} else {
console.error(
"No configuration file found and no output filename configured via CLI option."
);
console.error(
"A configuration file could be named 'webpack.config.js' in the current directory."
);
console.error("Use --help to display the CLI options.");
process.exit(-1); // eslint-disable-line
}
}

if (argv._.length > 0) {
if (Array.isArray(options.entry) || typeof options.entry === "string") {
options.entry = {
Expand Down Expand Up @@ -621,23 +592,5 @@ module.exports = function(yargs, argv, convertOptions) {
}
});
}

if (!options.entry) {
if (configFileLoaded) {
console.error("Configuration file found but no entry configured.");
} else {
console.error(
"No configuration file found and no entry configured via CLI option."
);
console.error(
"When using the CLI you need to provide at least two arguments: entry and output."
);
console.error(
"A configuration file could be named 'webpack.config.js' in the current directory."
);
}
console.error("Use --help to display the CLI options.");
process.exit(-1); // eslint-disable-line
}
}
};
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -86,7 +86,7 @@
},
"optionalDependencies": {
"schema-utils": "^0.4.2",
"webpack": "^4.0.0-alpha.0",
"webpack": "^4.0.0-alpha.1",
"webpack-dev-server": "^2.9.7"
}
}