Skip to content

Commit

Permalink
fix(bin): extension detection (webpack#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
lakatostamas committed Jan 5, 2019
1 parent 556a333 commit d1fedf8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/convert-argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,17 @@ module.exports = function(...args) {
const configArgList = Array.isArray(argv.config) ? argv.config : [argv.config];
configFiles = configArgList.map(mapConfigArg);
} else {
const defaultConfigFiles = ["webpack.config", "webpackfile"];
const webpackConfigFileRegExp = `(${defaultConfigFiles.join("|")})(${extensions.join("|")})`;
const defaultConfigFileNames = ["webpack.config", "webpackfile"].join("|");
const webpackConfigFileRegExp = `(${defaultConfigFileNames})(${extensions.join("|")})`;
const pathToWebpackConfig = findup(webpackConfigFileRegExp);

if (pathToWebpackConfig) {
const resolvedPath = path.resolve(pathToWebpackConfig);
const actualConfigFileName = path.basename(resolvedPath);
const ext = actualConfigFileName.replace(new RegExp(defaultConfigFileNames), "");
configFiles.push({
path: resolvedPath,
ext: resolvedPath.split(".").pop()
ext,
});
}
}
Expand Down

0 comments on commit d1fedf8

Please sign in to comment.