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
Copy file name to clipboardExpand all lines: src/content/api/cli.md
+31-7Lines changed: 31 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ title: Command Line Interface
3
3
sort: 1
4
4
contributors:
5
5
- anshumanv
6
+
- snitin315
6
7
- evenstensberg
7
8
- simon04
8
9
- tbroadley
@@ -61,10 +62,10 @@ Note: These are the flags with webpack v4, starting v5 CLI also supports [core f
61
62
|`--no-color`| boolean | Disables colors on console |
62
63
|`--merge, -m`| boolean | Merge two or more configurations using webpack-merge e.g. `-c ./webpack.config.js -c ./webpack.test.config.js`|
63
64
|`--env`| string[]| Environment passed to the configuration when it is a function |
64
-
|`--progress`| boolean| Print compilation progress during build |
65
+
|`--progress`| boolean, string| Print compilation progress during build |
65
66
|`--help`| boolean | Outputs list of supported flags and commands |
66
67
|`--output-path, -o`| string | Output location of the file generated by webpack e.g. `./dist`|
67
-
|`--target, -t`| string| Sets the build target |
68
+
|`--target, -t`| string[]| Sets the build target |
68
69
|`--watch, -w`| boolean | Watch for file changes |
69
70
|`--hot, -h`| boolean | Enables Hot Module Replacement |
70
71
|`--no-hot`| boolean | Disables Hot Module Replacement |
@@ -94,7 +95,7 @@ __Here's the list of all the core flags supported by webpack v5 with CLI v4 - [l
94
95
For example if you want to enable performance hints in your project you'd use [this](https://webpack.js.org/configuration/performance/#performancehints) option in configuration, with core flags you can do -
Resolves the given request to a module, applies all configured loaders and calls back with the generated source, the sourceMap and the module instance (usually an instance of [`NormalModule`](https://github.com/webpack/webpack/blob/master/lib/NormalModule.js)). Use this function if you need to know the source code of another module to generate the result.
392
392
393
-
`this.loadModule` in a loader context uses CommonJS resolve rules by default. Use `this.getResolve` with an appropriate `dependencyType`, e.g. `'esm'`, `'commonjs'` or a custom one before using a different semantic.
393
+
`this.loadModule` in a loader context uses CommonJS resolve rules by default. Use `this.getResolve` with an appropriate `dependencyType`, e.g. `'esm'`, `'commonjs'` or a custom one before using a different semantic.
@@ -167,7 +168,7 @@ __MIGRATION__: Use the default export.
167
168
168
169
Even when using the default export, unused properties are dropped by the `optimization.usedExports` optimization and properties are mangled by the `optimization.mangleExports` optimization.
169
170
170
-
It's possible to specify a custom JSON parser in `Rule.parser.parse` to import JSON-like files (e.g. for toml, yaml, json5, etc.).
171
+
It's possible to specify a custom JSON parser in `Rule.parser.parse` to import JSON-like files (e.g. for toml, yaml, json5, etc.).
171
172
172
173
### import.meta
173
174
@@ -474,7 +475,7 @@ The `target` option now influences more things about the generated code than bef
474
475
- Some loaders might change behavior based on that
475
476
476
477
For some of these things the choice between `"web"` and `"node"` is too rough and we need more information.
477
-
Therefore we allow to specify the minimum version e.g. like `"node10.13"` and infer more properties about the target environment.
478
+
Therefore we allow to specify the minimum version e.g. like `"node10.13"` and infer more properties about the target environment.
478
479
479
480
It's now also allowed to combined multiple targets with an array and webpack will determine the minimum properties of all targets. Using an array is also useful when using targets that doesn't give full information like `"web"` or `"node"` (without version number). E. g. `["web", "es2020"]` combines these two partial targets.
480
481
@@ -712,7 +713,7 @@ __MIGRATION__: Upgrade to the latest Node.js version available.
712
713
-`output.chunkFilename: Function` is now allowed
713
714
-`output.hotUpdateChunkFilename: Function` is now forbidden: It never worked anyway.
714
715
-`output.hotUpdateMainFilename: Function` is now forbidden: It never worked anyway.
715
-
-`output.importFunctionName: string` specifies the name used as replacement for `import()` to allow polyfilling for non-suppored environments
716
+
-`output.importFunctionName: string` specifies the name used as replacement for `import()` to allow polyfilling for non-supported environments
716
717
-`output.charset` added: setting it to false omit the `charset` property on script tags
717
718
-`output.hotUpdateFunction` renamed to `output.hotUpdateGlobal`
718
719
-`output.jsonpFunction` renamed to `output.chunkLoadingGlobal`
@@ -734,7 +735,7 @@ __MIGRATION__: Upgrade to the latest Node.js version available.
734
735
-`stats.chunkRelations` added: Show parent/children/sibling chunks
735
736
-`stats.errorStack` added: Show webpack-internal stack trace of errors
736
737
-`stats.preset` added: select a preset
737
-
-`stats.relatedAssets` added: show assets that are related to other assets (e.g. SourceMaps)
738
+
-`stats.relatedAssets` added: show assets that are related to other assets (e.g. SourceMaps)
738
739
-`stats.warningsFilter` deprecated in favor of `ignoreWarnings`
739
740
-`BannerPlugin.banner` signature changed
740
741
-`data.basename` removed
@@ -802,7 +803,7 @@ __MIGRATION__: This can be implemented in the loader itself
802
803
803
804
`getResolve(options)` in the loader API will merge options in a different way, see `module.rules``resolve`.
804
805
805
-
As webpack 5 differs between different issuing dependencies so it might make sense to pass a `dependencyType` as option (e.g. `"esm"`, `"commonjs"`, or others).
806
+
As webpack 5 differs between different issuing dependencies so it might make sense to pass a `dependencyType` as option (e.g. `"esm"`, `"commonjs"`, or others).
806
807
807
808
## Major Internal Changes
808
809
@@ -1094,7 +1095,7 @@ __MIGRATION__: Instead of replacing the whole Stats functionality, you can now c
1094
1095
1095
1096
### New Watching
1096
1097
1097
-
The watcher used by webpack was refactored. It was previously using `chokidar` and the native dependency `fsevents` (only on OSX). Now it's only based on native Node.js `fs`. This means there is no native dependency left in webpack.
1098
+
The watcher used by webpack was refactored. It was previously using `chokidar` and the native dependency `fsevents` (only on macOS). Now it's only based on native Node.js `fs`. This means there is no native dependency left in webpack.
1098
1099
1099
1100
It also captures more information about filesystem while watching. It now captures mtimes and watches event times, as well as information about missing files. For this, the `WatchFileSystem` API changed a little bit. While on it we also converted Arrays to Sets and Objects to Maps.
1100
1101
@@ -1218,7 +1219,7 @@ These dependencies are cheaper to process and webpack uses them when possible
1218
1219
1219
1220
## Other Minor Changes
1220
1221
1221
-
- removed buildin directory and replaced buildins with runtime modules
1222
+
- removed builtin directory and replaced builtins with runtime modules
1222
1223
- Removed deprecated features
1223
1224
- BannerPlugin now only support one argument that can be an object, string or function
1224
1225
- removed `CachePlugin`
@@ -1393,7 +1394,7 @@ These dependencies are cheaper to process and webpack uses them when possible
1393
1394
- DependencyReference now takes a function to a module instead of a Module
0 commit comments