More helpful error message if we can't find webpack config file

This commit is contained in:
Adam Krebs 2015-04-08 13:59:21 -04:00
parent 2875e402d7
commit 7cc35ce10f
1 changed files with 10 additions and 5 deletions

View File

@ -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];