Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/create-webpack-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ program
.option("-t --template <template>", "Template to be used for scaffolding", "default")
.action(async function (projectPath, opts: InitOptions) {
const { force } = opts;
let templateOption = opts.template as string;
let templateOption = opts.template;
let generator = initGenerators[templateOption];

if (generator === undefined) {
Expand Down Expand Up @@ -134,7 +134,7 @@ program
.argument("[projectPath]", "Path to create the project")
.option("-t --template <template>", "Template to be used for scaffolding", "default")
.action(async function (projectPath, opts: LoaderOptions) {
let templateOption = opts.template as string;
let templateOption = opts.template;
let generator = loaderGenerators[templateOption];

if (generator === undefined) {
Expand Down Expand Up @@ -175,7 +175,7 @@ program
.argument("[projectPath]", "Path to create the project")
.option("-t --template <template>", "Template to be used for scaffolding", "default")
.action(async function (projectPath, opts: PluginOptions) {
let templateOption = opts.template as string;
let templateOption = opts.template;
let generator = pluginGenerators[templateOption];

if (generator === undefined) {
Expand Down
17 changes: 6 additions & 11 deletions packages/webpack-cli/src/webpack-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ class WebpackCLI implements IWebpackCLI {

const flag = this.getBuiltInOptions().find((flag) => option.long === `--${flag.name}`);

if (flag && flag.configs) {
if (flag?.configs) {
const possibleValues = flag.configs.reduce(
(accumulator, currentValue) => {
if (currentValue.values) {
Expand Down Expand Up @@ -2243,9 +2243,8 @@ class WebpackCLI implements IWebpackCLI {

if (
options.isWatchingLikeCommand &&
options.argv &&
options.argv.env &&
(typeof originalWatchValue !== "undefined" || typeof options.argv.watch !== "undefined")
options.argv?.env &&
(typeof originalWatchValue !== "undefined" || typeof options.argv?.watch !== "undefined")
) {
this.logger.warn(
`No need to use the '${
Expand Down Expand Up @@ -2292,8 +2291,7 @@ class WebpackCLI implements IWebpackCLI {
// Respect `process.env.NODE_ENV`
if (
!item.mode &&
process.env &&
process.env.NODE_ENV &&
process.env?.NODE_ENV &&
(process.env.NODE_ENV === "development" ||
process.env.NODE_ENV === "production" ||
process.env.NODE_ENV === "none")
Expand Down Expand Up @@ -2408,14 +2406,11 @@ class WebpackCLI implements IWebpackCLI {
needWatchStdin(compiler: Compiler | MultiCompiler): boolean {
if (this.isMultipleCompiler(compiler)) {
return Boolean(
compiler.compilers.some(
(compiler: Compiler) =>
compiler.options.watchOptions && compiler.options.watchOptions.stdin,
),
compiler.compilers.some((compiler: Compiler) => compiler.options.watchOptions?.stdin),
);
}

return Boolean(compiler.options.watchOptions && compiler.options.watchOptions.stdin);
return Boolean(compiler.options.watchOptions?.stdin);
}

async runWebpack(options: WebpackRunOptions, isWatchCommand: boolean): Promise<void> {
Expand Down