Skip to content

Commit 0b6bab3

Browse files
committed
chore: better defaults
1 parent 78436ff commit 0b6bab3

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

bin/convert-argv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ module.exports = function(...args) {
7777
const resolvedPath = path.resolve(pathToWebpackConfig);
7878
configFiles.push({
7979
path: resolvedPath,
80-
ext: resolvedPath.split(".").pop(),
80+
ext: resolvedPath.split(".").pop()
8181
});
8282
}
8383
}

bin/prompt-command.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,7 @@ module.exports = function promptForInstallation(packages, ...args) {
3535
try {
3636
const path = require("path");
3737
const fs = require("fs");
38-
pathForCmd = path.resolve(
39-
process.cwd(),
40-
"node_modules",
41-
"@webpack-cli",
42-
packages
43-
);
38+
pathForCmd = path.resolve(process.cwd(), "node_modules", "@webpack-cli", packages);
4439
if (!fs.existsSync(pathForCmd)) {
4540
const globalModules = require("global-modules");
4641
pathForCmd = globalModules + "/@webpack-cli/" + packages;

packages/generators/init-generator.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ export default class InitGenerator extends Generator {
9696
return entryQuestions(self, entryTypeAnswer);
9797
})
9898
.then((entryOptions: object | string) => {
99+
if(typeof entryOptions === 'string' && entryOptions.length > 0) {
100+
return this.prompt([
101+
Input(
102+
"outputType",
103+
"Which folder will your generated bundles be in? [default: dist]:",
104+
),
105+
]);
106+
}
99107
if (entryOptions !== "\"\"") {
100108
this.configuration.config.webpackOptions.entry = entryOptions;
101109
}
@@ -132,9 +140,9 @@ export default class InitGenerator extends Generator {
132140
.then((_: void) => {
133141
this.isProd = this.usingDefaults ? true : false;
134142
this.configuration.config.configName = this.isProd ? "prod" : "dev";
135-
this.configuration.config.webpackOptions.mode = this.isProd
136-
? "'production'"
137-
: "'development'";
143+
if(!this.isProd) {
144+
this.configuration.config.webpackOptions.mode = "'development'";
145+
}
138146
this.configuration.config.webpackOptions.plugins = this.isProd ? [] : getDefaultPlugins();
139147
return this.prompt([
140148
Confirm("babelConfirm", "Will you be using ES2015?"),

0 commit comments

Comments
 (0)