Skip to content

Commit

Permalink
fix: refactor redundant code
Browse files Browse the repository at this point in the history
this.groups.push(GroupInstance) was common to both if and else clause
added one liner ternary operation instead of if else to set mode value.
  • Loading branch information
godcrampy committed Nov 18, 2019
1 parent c193b96 commit c7b77a0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/webpack-cli.js
Expand Up @@ -81,15 +81,9 @@ class WebpackCLI extends GroupHelper {
}
const GroupInstance = new GroupClass(value);
if (key === 'basic') {
if (GroupInstance.opts.outputOptions.dev) {
mode = 'dev';
} else {
mode = 'prod';
}
this.groups.push(GroupInstance);
} else {
this.groups.push(GroupInstance);
mode = GroupInstance.opts.outputOptions.dev ? 'dev' : 'prod';
}
this.groups.push(GroupInstance);
}
}

Expand Down

0 comments on commit c7b77a0

Please sign in to comment.