You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[`--entry`](#entry)| string[]| The entry point(s) of your application e.g. `./src/main.js`|
263
+
|[`--config, -c`](#config)| string[]| Provide path to a webpack configuration file e.g. `./webpack.config.js`|
264
+
|[`--config-name`](#config-name)| string[]| Name of the configuration to use |
265
+
|`--name`| string | Name of the configuration. Used when loading multiple configurations |
266
+
|`--color`| boolean | Enable colors on console |
267
+
|[`--merge, -m`](#merge)| boolean | Merge two or more configurations using `webpack-merge`|
268
+
|[`--env`](#env)| string[]| Environment passed to the configuration when it is a function |
269
+
|[`--config-node-env`](#config-node-env)| string | Set `process.env.NODE_ENV` to the specified value |
270
+
|[`--progress`](#progress)| boolean, string | Print compilation progress during build |
271
+
|[`--help`](#help)| boolean | Outputs list of supported flags and commands |
272
+
|[`--output-path, -o`](#output-path)| string | Output location of the file generated by webpack e.g. `./dist`|
273
+
|`--target, -t`| string[]| Sets the build target |
274
+
|`--watch, -w`| boolean | Watch for file changes |
275
+
|`--watch-options-stdin`| boolean | Stop watching when stdin stream has ended |
276
+
|`--devtool, -d`| string | Controls if and how source maps are generated. |
277
+
|[`--json, -j`](#json)| boolean, string | Prints result as JSON or store it in a file |
278
+
|`--mode`| string | Defines the mode to pass to webpack |
279
+
|[`--version, -v`](#version)| boolean | Get current version |
280
+
|`--stats`| boolean, string | It instructs webpack on how to treat the stats |
281
+
|`--disable-interpret`| boolean | Disable interpret for loading the config file. |
282
+
|`--fail-on-warnings`| boolean | Stop webpack-cli process with non-zero exit code on warnings from webpack |
283
+
|[`--analyze`](#analyzing-bundle)| boolean | It invokes `webpack-bundle-analyzer` plugin to get bundle information |
284
+
|[`--extends, -e`](#extends)| string[]| Extend an existing configuration |
285
285
286
286
### Negated Flags
287
287
@@ -632,25 +632,25 @@ You can use `--node-env` option to set `process.env.NODE_ENV`, which is availabl
632
632
npx webpack --node-env production # process.env.NODE_ENV = 'production'
633
633
```
634
634
635
-
W> This option is deprecated and removed in webpack-cli v5 in favor of the `--define-process-env-node-env` option.
635
+
W> This option is deprecated in webpack-cli v6 in favor of the `--config-node-env` option.
636
636
637
-
### define-process-env-node-env
637
+
### config-node-env
638
638
639
-
For `webpack-cli v5+`.
639
+
<Badgetext="webpack-cli v6.0.0+" />
640
640
641
641
An alias for [`--node-env`](/api/cli/#node-env) to set `process.env.NODE_ENV`:
642
642
643
643
```bash
644
-
npx webpack --define-process-env-node-env production # process.env.NODE_ENV = 'production'
644
+
npx webpack --config-node-env production # process.env.NODE_ENV = 'production'
645
645
```
646
646
647
-
When the `mode` option is not specified in the configuration, you can use the `--define-process-env-node-env` option to set the `mode`. For example, using `--define-process-env-node-env production` will set both `process.env.NODE_ENV` and `mode` to `'production'`.
647
+
When the `mode` option is not specified in the configuration, you can use the `--config-node-env` option to set the `mode`. For example, using `--config-node-env production` will set both `process.env.NODE_ENV` and `mode` to `'production'`.
648
648
649
-
If your configuration exports a function, the value of `--define-process-env-node-env` is assigned to mode after the function returns. This means that `mode` will not be available in the function arguments (`env` and `argv`). However, the value of `--define-process-env-node-env` is accessible as `argv.nodeEnv` within the function and can be used accordingly.
649
+
If your configuration exports a function, the value of `--config-node-env` is assigned to mode after the function returns. This means that `mode` will not be available in the function arguments (`env` and `argv`). However, the value of `--config-node-env` is accessible as `argv.nodeEnv` within the function and can be used accordingly.
650
650
651
651
```javascript
652
652
module.exports= (env, argv) => {
653
-
console.log(argv.defineProcessEnvNodeEnv); // 'production' if --define-process-env-node-env production is used
653
+
console.log(argv.defineProcessEnvNodeEnv); // 'production' if --config-node-env production is used
0 commit comments