@@ -130,30 +130,30 @@ webpack --env.platform=web # sets env.platform == "web"
130
130
131
131
The ` --env ` argument accepts various syntaxes:
132
132
133
- | Invocation | Resulting environment |
134
- | -------------------------------| ----------------------------- |
135
- | webpack --env prod | ` "prod" ` |
136
- | webpack --env.prod | ` { prod: true } ` |
137
- | webpack --env.prod=1 | ` { prod: 1 } ` |
138
- | webpack --env.prod=foo | ` { prod: "foo" } ` |
139
- | webpack --env.prod --env.min | ` { prod: true, min: true } ` |
140
- | webpack --env.prod --env min | ` [{ prod: true }, "min"] ` |
133
+ Invocation | Resulting environment
134
+ ------------------------------- | ---------------------------
135
+ ` webpack --env prod ` | ` "prod" `
136
+ ` webpack --env.prod ` | ` { prod: true } `
137
+ ` webpack --env.prod=1 ` | ` { prod: 1 } `
138
+ ` webpack --env.prod=foo ` | ` { prod: "foo" } `
139
+ ` webpack --env.prod --env.min ` | ` { prod: true, min: true } `
140
+ ` webpack --env.prod --env min ` | ` [{ prod: true }, "min"] `
141
141
142
142
### Output Options
143
143
144
144
This set of options allows you to manipulate certain [ output] ( /configuration/output ) parameters of your build.
145
145
146
- | Parameter | Explanation | Input type | Default value |
147
- | ------------------------------ | ----------------------------------------------------------------- | ------------ | ------------------------------------------------------- |
148
- | --output-chunk-filename | The output filename for additional chunks | string | filename with [ id] instead of [ name] or [ id] prefixed |
149
- | --output-filename | The output filename of the bundle | string | [ name] .js |
150
- | --output-jsonp-function | The name of the JSONP function used for chunk loading | string | webpackJsonp |
151
- | --output-library | Expose the exports of the entry point as library | string | |
152
- | --output-library-target | The type for exposing the exports of the entry,point as library | string | var |
153
- | --output-path | The output path for compilation assets | string | Current directory |
154
- | --output-pathinfo | Include a comment with the request for every dependency | boolean | false |
155
- | --output-public-path | The public path for the assets | string | / |
156
- | --output-source-map-filename | The output filename for the SourceMap | string | [ name] .map or [ outputFilename] .map |
146
+ Parameter | Explanation | Input type | Default
147
+ ------------------------- | ------------------------------------------- | ---------- | ------------------
148
+ ` --output-chunk-filename ` | The output filename for additional chunks | string | filename with [ id] instead of [ name] or [ id] prefixed
149
+ ` --output-filename ` | The output filename of the bundle | string | [ name] .js
150
+ ` --output-jsonp-function ` | The name of the JSONP function used for chunk loading | string | webpackJsonp
151
+ ` --output-library ` | Expose the exports of the entry point as library | string |
152
+ ` --output-library-target ` | The type for exposing the exports of the entry,point as library | string | var
153
+ ` --output-path ` | The output path for compilation assets | string | Current directory
154
+ ` --output-pathinfo ` | Include a comment with the request for every dependency | boolean | false
155
+ ` --output-public-path ` | The public path for the assets | string | /
156
+ ` --output-source-map-filename ` | The output filename for the SourceMap | string | [ name] .map or [ outputFilename] .map
157
157
158
158
159
159
#### Example Usage
@@ -189,104 +189,104 @@ webpack.js index=./src/index.js index2=./src/index2.js --output-path='./dist' --
189
189
190
190
This set of options allows you to better debug the application containing assets compiled with webpack
191
191
192
- | Parameter | Explanation | Input type | Default value |
193
- | ------------| -------------------------------------------------- | ------------ | --------------- |
194
- | --debug | Switch loaders to debug mode | boolean | false |
195
- | --devtool | Define [ source map type] ( /configuration/devtool/ ) for the bundled resources | string | - |
196
- | --progress | Print compilation progress in percentage | boolean | false |
192
+ Parameter | Explanation | Input type | Default value
193
+ ------------ | ------------------------------------------------ | ---------- | -------------
194
+ ` --debug ` | Switch loaders to debug mode | boolean | false
195
+ ` --devtool ` | Define [ source map type] ( /configuration/devtool/ ) for the bundled resources | string | -
196
+ ` --progress ` | Print compilation progress in percentage | boolean | false
197
197
198
198
199
199
### Module Options
200
200
201
201
These options allow you to bind [ modules] ( /configuration/module/ ) as allowed by webpack
202
202
203
- | Parameter | Explanation | Usage |
204
- | --------------------| ------------------------------------ | ----------------------------- |
205
- | --module-bind | Bind an extension to a loader | --module-bind js=babel-loader |
206
- | --module-bind-post | Bind an extension to a post loader | |
207
- | --module-bind-pre | Bind an extension to a pre loader | |
203
+ Parameter | Explanation | Usage
204
+ -------------------- | ---------------------------------- | ----------------
205
+ ` --module-bind ` | Bind an extension to a loader | ` --module-bind js=babel-loader `
206
+ ` --module-bind-post ` | Bind an extension to a post loader |
207
+ ` --module-bind-pre ` | Bind an extension to a pre loader |
208
208
209
209
210
210
### Watch Options
211
211
212
212
These options makes the build [ watch] ( /configuration/watch/ ) for changes in files of the dependency graph and perform the build again.
213
213
214
- | Parameter | Explanation |
215
- | --------------------------- | --------------------------------------------------------- |
216
- | --watch, -w | Watch the filesystem for changes |
217
- | --save, -s | Recompiles on save regardless of changes |
218
- | --watch-aggregate-timeout | Timeout for gathering changes while watching |
219
- | --watch-poll | The polling interval for watching (also enable polling) |
220
- | --watch-stdin, --stdin | Exit the process when stdin is closed |
214
+ Parameter | Explanation
215
+ ------------------------- | ----------------------
216
+ ` --watch ` , ` -w ` | Watch the filesystem for changes
217
+ ` --save ` , ` -s ` | Recompiles on save regardless of changes
218
+ ` --watch-aggregate-timeout ` | Timeout for gathering changes while watching
219
+ ` --watch-poll ` | The polling interval for watching (also enable polling)
220
+ ` --watch-stdin ` , ` --stdin ` | Exit the process when stdin is closed
221
221
222
222
223
223
### Optimize Options
224
224
225
225
These options allow you to manipulate optimisations for a production build using webpack
226
226
227
- | Parameter | Explanation | Plugin used |
228
- | ---------------------------| -------------------------------------------------------- | -------------------------------------- |
229
- | --optimize-max-chunks | Try to keep the chunk count below a limit | [ LimitChunkCountPlugin] ( /plugins/limit-chunk-count-plugin ) |
230
- | --optimize-min-chunk-size | Try to keep the chunk size above a limit | [ MinChunkSizePlugin] ( /plugins/min-chunk-size-plugin ) |
231
- | --optimize-minimize | Minimize javascript and switches loaders to minimizing | [ UglifyJsPlugin] ( /plugins/uglifyjs-webpack-plugin/ ) & [ LoaderOptionsPlugin] ( /plugins/loader-options-plugin/ ) |
227
+ Parameter | Explanation | Plugin Used
228
+ --------------------------- | -------------------------------------------------------|----------------------
229
+ ` --optimize-max-chunks ` | Try to keep the chunk count below a limit | [ LimitChunkCountPlugin] ( /plugins/limit-chunk-count-plugin )
230
+ ` --optimize-min-chunk-size ` | Try to keep the chunk size above a limit | [ MinChunkSizePlugin] ( /plugins/min-chunk-size-plugin )
231
+ ` --optimize-minimize ` | Minimize javascript and switches loaders to minimizing | [ UglifyJsPlugin] ( /plugins/uglifyjs-webpack-plugin/ ) & [ LoaderOptionsPlugin] ( /plugins/loader-options-plugin/ )
232
232
233
233
234
234
### Resolve Options
235
235
236
236
These allow you to configure the webpack [ resolver] ( /configuration/resolve/ ) with aliases and extensions.
237
237
238
- | Parameter | Explanation | Example |
239
- | ------------------------ | --------------------------------------------------------- | --------------------------------------------- |
240
- | --resolve-alias | Setup a module alias for resolving | --resolve-alias jquery-plugin=jquery.plugin |
241
- | --resolve-extensions | Setup extensions that should be used to resolve,modules | --resolve-extensions .es6 .js .ts |
242
- | --resolve-loader-alias | Minimize javascript and switches loaders to minimizing | |
238
+ Parameter | Explanation | Example
239
+ ---------------------- | ------------------------------------------------------- | -------------
240
+ --resolve-alias | Setup a module alias for resolving | --resolve-alias jquery-plugin=jquery.plugin
241
+ --resolve-extensions | Setup extensions that should be used to resolve,modules | --resolve-extensions .es6 .js .ts
242
+ --resolve-loader-alias | Minimize javascript and switches loaders to minimizing |
243
243
244
244
245
245
### Stats Options
246
246
247
247
These options allow webpack to display various [ stats] ( /configuration/stats/ ) and style them differently in the console output.
248
248
249
- | Parameter | Explanation | Type |
250
- | --------------------------------| -------------------------------------------------------------------- | --------- |
251
- | --color, --colors | Enables/Disables colors on the console [ default: (supports-color)] | boolean |
252
- | --display | Select [ display preset] ( /configuration/stats ) (verbose, detailed, normal, minimal, errors-only, none; since webpack 3.0.0) | string |
253
- | --display-cached | Display also cached modules in the output | boolean |
254
- | --display-cached-assets | Display also cached assets in the output | boolean |
255
- | --display-chunks | Display chunks in the output | boolean |
256
- | --display-depth | Display distance from entry point for each module | boolean |
257
- | --display-entrypoints | Display entry points in the output | boolean |
258
- | --display-error-details | Display details about errors | boolean |
259
- | --display-exclude | Exclude modules in the output | boolean |
260
- | --display-max-modules | Sets the maximum number of visible modules in output | number |
261
- | --display-modules | Display even excluded modules in the output | boolean |
262
- | --display-optimization-bailout | Scope hoisting fallback trigger (since webpack 3.0.0) | boolean |
263
- | --display-origins | Display origins of chunks in the output | boolean |
264
- | --display-provided-exports | Display information about exports provided from modules | boolean |
265
- | --display-reasons | Display reasons about module inclusion in the output | boolean |
266
- | --display-used-exports | Display information about used exports in modules (Tree Shaking) | boolean |
267
- | --hide-modules | Hides info about modules | boolean |
268
- | --sort-assets-by | Sorts the assets list by property in asset | string |
269
- | --sort-chunks-by | Sorts the chunks list by property in chunk | string |
270
- | --sort-modules-by | Sorts the modules list by property in module | string |
271
- | --verbose | Show more details | boolean |
249
+ Parameter | Explanation | Type
250
+ -------------------------------- | ------------------------------------------------------------------ | -------
251
+ ` --color ` , ` --colors ` | Enables/Disables colors on the console [ default: (supports-color)] | boolean
252
+ ` --display ` | Select [ display preset] ( /configuration/stats ) (verbose, detailed, normal, minimal, errors-only, none; since webpack 3.0.0) | string
253
+ ` --display-cached ` | Display also cached modules in the output | boolean
254
+ ` --display-cached-assets ` | Display also cached assets in the output | boolean
255
+ ` --display-chunks ` | Display chunks in the output | boolean
256
+ ` --display-depth ` | Display distance from entry point for each module | boolean
257
+ ` --display-entrypoints ` | Display entry points in the output | boolean
258
+ ` --display-error-details ` | Display details about errors | boolean
259
+ ` --display-exclude ` | Exclude modules in the output | boolean
260
+ ` --display-max-modules ` | Sets the maximum number of visible modules in output | number
261
+ ` --display-modules ` | Display even excluded modules in the output | boolean
262
+ ` --display-optimization-bailout ` | Scope hoisting fallback trigger (since webpack 3.0.0) | boolean
263
+ ` --display-origins ` | Display origins of chunks in the output | boolean
264
+ ` --display-provided-exports ` | Display information about exports provided from modules | boolean
265
+ ` --display-reasons ` | Display reasons about module inclusion in the output | boolean
266
+ ` --display-used-exports ` | Display information about used exports in modules (Tree Shaking) | boolean
267
+ ` --hide-modules ` | Hides info about modules | boolean
268
+ ` --sort-assets-by ` | Sorts the assets list by property in asset | string
269
+ ` --sort-chunks-by ` | Sorts the chunks list by property in chunk | string
270
+ ` --sort-modules-by ` | Sorts the modules list by property in module | string
271
+ ` --verbose ` | Show more details | boolean
272
272
273
273
274
274
### Advanced Options
275
275
276
- | Parameter | Explanation | Usage |
277
- | ----------------------- | ------------------------------------------------------------------ | --------------------------------------------- |
278
- | --bail | Abort the compilation on first error | |
279
- | --cache | Enable in memory caching [ Enabled by default for watch] | --cache=false |
280
- | --define | Define any free var in the bundle , see [ shimming] ( /guides/shimming ) | --define process.env.NODE_ENV='development' |
281
- | --hot | Enables [ Hot Module Replacement] ( /concepts/hot-module-replacement ) [ Uses HotModuleReplacementPlugin ] | --hot=true |
282
- | --labeled-modules | Enables labeled modules [ Uses LabeledModulesPlugin] | |
283
- | --plugin | Load this [ plugin] ( /configuration/plugins/ ) | |
284
- | --prefetch | Prefetch the particular file | --prefetch=./files.js |
285
- | --provide | Provide these modules as free vars in all modules , see [ shimming] ( /guides/shimming ) | --provide jQuery=jquery |
286
- | --records-input-path | Path to the records file (reading) | |
287
- | --records-output-path | Path to the records file (writing) | |
288
- | --records-path | Path to the records file | |
289
- | --target | The [ targeted] ( /configuration/target/ ) execution environment | --target='node' |
276
+ Parameter | Explanation | Usage
277
+ ----------------- | ---------------------------------------- | -----
278
+ ` --bail ` | Abort the compilation on first error |
279
+ ` --cache ` | Enable in memory caching [ Enabled by default for watch] | ` --cache=false `
280
+ ` --define ` | Define any free variable , see [ shimming] ( /guides/shimming ) | ` --define process.env.NODE_ENV='development' `
281
+ ` --hot ` | Enables [ Hot Module Replacement] ( /concepts/hot-module-replacement ) | ` --hot=true `
282
+ ` --labeled-modules ` | Enables labeled modules [ Uses LabeledModulesPlugin] |
283
+ ` --plugin ` | Load this [ plugin] ( /configuration/plugins/ ) |
284
+ ` --prefetch ` | Prefetch the particular file | ` --prefetch=./files.js `
285
+ ` --provide ` | Provide these modules as globals , see [ shimming] ( /guides/shimming ) | ` --provide jQuery=jquery `
286
+ ` --records-input-path ` | Path to the records file (reading) |
287
+ ` --records-output-path ` | Path to the records file (writing) |
288
+ ` --records-path ` | Path to the records file |
289
+ ` --target ` | The [ targeted] ( /configuration/target/ ) execution environment | ` --target='node' `
290
290
291
291
### Shortcuts
292
292
0 commit comments