Skip to content

Commit

Permalink
fix: default config merge repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
hubcarl committed Jan 17, 2018
1 parent 682200b commit 79939ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ const WebpackDllBuilder = require('./dll');
const utils = require('../utils/utils');
const baseDir = process.cwd();
exports.getBuilderConfig = (config = {}, option = {}) => {
if (typeof config === 'string') {
if (utils.isString(config)) {
const filepath = path.isAbsolute(config) ? config : path.resolve(baseDir, config);
if (fs.existsSync(filepath)) {
return merge({ baseDir }, require(filepath));
}
return { baseDir };
}
if (utils.isObject(config) && (config.entry || config.framework || config.egg || config.lib || config.dll)) {
return merge({ baseDir }, config);
}
const filepath = path.join(config.baseDir || baseDir, 'webpack.config.js');
if (fs.existsSync(filepath)) {
return merge({ baseDir }, require(filepath), config);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "easywebpack",
"version": "3.6.2",
"version": "3.6.3",
"description": "基于 Webpack 的前端构建工程化解决方案",
"keywords": [
"webpack",
Expand Down

0 comments on commit 79939ae

Please sign in to comment.