diff --git a/packages/generators/init-generator.ts b/packages/generators/init-generator.ts index a50f04813d3..715b44e8797 100644 --- a/packages/generators/init-generator.ts +++ b/packages/generators/init-generator.ts @@ -92,13 +92,11 @@ export default class InitGenerator extends Generator { .then( (entryOptions: object | string): Promise<{}> => { if (typeof entryOptions === "string" && entryOptions.length > 0) { - return this.prompt([ - Input("outputType", "In which folder do you want to store your generated bundles? (dist):") - ]); - } - if (entryOptions !== '""') { - this.configuration.config.webpackOptions.entry = entryOptions; + if (entryOptions !== "\"\"" && entryOptions !== "\'\'") { + this.configuration.config.webpackOptions.entry = entryOptions; + } } + return this.prompt([ Input("outputType", "In which folder do you want to store your generated bundles? (dist):") ]); diff --git a/packages/generators/remove-generator.ts b/packages/generators/remove-generator.ts index 9169a42ffad..9af3b862592 100644 --- a/packages/generators/remove-generator.ts +++ b/packages/generators/remove-generator.ts @@ -32,13 +32,9 @@ export default class RemoveGenerator extends Generator { webpackOptions: {} } }; - - let configPath = path.resolve(process.cwd(), "webpack.config.js"); + const { configFile } = opts; + let configPath = path.resolve(process.cwd(), configFile); const webpackConfigExists = fs.existsSync(configPath); - if (!webpackConfigExists) { - configPath = null; - // end the generator stating webpack config not found or to specify the config - } this.webpackOptions = require(configPath); } diff --git a/packages/utils/modify-config-helper.ts b/packages/utils/modify-config-helper.ts index e836f283991..5d25385c8c0 100644 --- a/packages/utils/modify-config-helper.ts +++ b/packages/utils/modify-config-helper.ts @@ -64,7 +64,7 @@ export default function modifyHelperUtil( logSymbols.error + chalk.red(" ERROR ") + chalk.cyan(configFile) + - " not found. Please specify a valid path to your webpack config like " + + " not found. Please specify a valid path to your webpack config like \n " + chalk.white("$ ") + chalk.cyan(`webpack-cli ${action} webpack.dev.js`) + "\n" @@ -87,10 +87,11 @@ export default function modifyHelperUtil( } }; } + env.registerStub(generator, generatorName); - - env.run(generatorName) - .then( + env.run(generatorName, { + configFile + }).then( (): void => { let configModule: object; try {