From 7cc35ce10f37ad281e201106d5b7011ecd467ac4 Mon Sep 17 00:00:00 2001 From: Adam Krebs Date: Wed, 8 Apr 2015 13:59:21 -0400 Subject: [PATCH] More helpful error message if we can't find webpack config file --- bin/convert-argv.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/convert-argv.js b/bin/convert-argv.js index 8397e6484..afb2d7d5c 100644 --- a/bin/convert-argv.js +++ b/bin/convert-argv.js @@ -27,19 +27,24 @@ module.exports = function(optimist, argv, convertOptions) { argv["optimize-occurence-order"] = true; } - var configPath, extname; + var configPath, ext; if (argv.config) { configPath = argv.config; - extname = path.extname(configPath); + ext = path.extname(configPath); } else { - Object.keys(interpret.extensions).some(function(ext) { - extname = ext; + var found = Object.keys(interpret.extensions).some(function(extname) { + ext = extname; configPath = path.resolve('webpack.config' + ext); return fs.existsSync(configPath); }); + + if (!found) { + configPath = 'webpack.config.js'; + ext = '.js'; + } } - var moduleName = interpret.extensions[extname]; + var moduleName = interpret.extensions[ext]; if (moduleName) { var compiler = require(moduleName); var register = interpret.register[moduleName];