Skip to content

docs(config,plugins) type updates #3294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 30, 2019
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
30 changes: 27 additions & 3 deletions src/content/configuration/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,44 @@ module.exports = {

## `output.chunkFilename`

`string`
`string = '[id].js'`

This option determines the name of non-entry chunk files. See [`output.filename`](#outputfilename) option for details on the possible values.

Note that these filenames need to be generated at runtime to send the requests for chunks. Because of this, placeholders like `[name]` and `[chunkhash]` need to add a mapping from chunk id to placeholder value to the output bundle with the webpack runtime. This increases the size and may invalidate the bundle when placeholder value for any chunk changes.

By default `[id].js` is used or a value inferred from [`output.filename`](#outputfilename) (`[name]` is replaced with `[id]` or `[id].` is prepended).

__webpack.config.js__

```javascript
module.exports = {
//...
output: {
//...
chunkFilename: '[id].js'
}
};
```


## `output.chunkLoadTimeout`

`number`
`number = 120000`

Number of milliseconds before chunk request expires, defaults to 120 000. This option is supported since webpack 2.6.0.
Number of milliseconds before chunk request expires. This option is supported since webpack 2.6.0.

__webpack.config.js__

```javascript
module.exports = {
//...
output: {
//...
chunkLoadTimeout: 30000
}
};
```


## `output.crossOriginLoading`
Expand Down
19 changes: 11 additions & 8 deletions src/content/plugins/progress-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ contributors:
- byzyk
---

`object` `function (percentage: number, message: string, ...args: string[])`
`
object = { boolean activeModules = true, boolean entries = false, function (number percentage, string message, [string] ...args) handler, boolean modules = true, number modulesCount = 500, boolean profile = false }`

`function (number percentage, string message, [string] ...args)`

The `ProgressPlugin` provides a way to customize how progress is reported during a compilation.

Expand All @@ -15,7 +18,7 @@ The `ProgressPlugin` provides a way to customize how progress is reported during
Create an instance of `ProgressPlugin` and provide one of the allowed params.

### Providing `function`

Provide a handler function which will be called when hooks report progress. `handler` function arguments:

- `percentage`: a number between 0 and 1 indicating the completion percentage of the compilation
Expand All @@ -36,12 +39,12 @@ new webpack.ProgressPlugin(handler);

When providing an `object` to the `ProgressPlugin`, following properties are supported:

- `activeModules: boolean = true` show's active modules count and one active module in progress message
- `entries: boolean = false` show's entries count in progress message
- [`handler: function(percentage, message, ...args)`](#providing-function)
- `modules: boolean = true` show's modules count in progress message
- `modulesCount: number = 500` a minimum modules count to start with. Takes effect when `modules` property is enabled.
- `profile: true | false | null = false` tells `ProgressPlugin` to collect profile data for progress steps.
- `activeModules` show's active modules count and one active module in progress message
- `entries` show's entries count in progress message
- [`handler: function (percentage, message, ...args)`](#providing-function)
- `modules` show's modules count in progress message
- `modulesCount` a minimum modules count to start with. Takes effect when `modules` property is enabled.
- `profile` tells `ProgressPlugin` to collect profile data for progress steps.


```js
Expand Down
15 changes: 8 additions & 7 deletions src/content/plugins/source-map-dev-tool-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ contributors:
- simon04
- neilkennedy
- byzyk
- EugeneHlushko
related:
- title: Building Source Maps
url: https://survivejs.com/webpack/building/source-maps/#-sourcemapdevtoolplugin-and-evalsourcemapdevtoolplugin-
Expand All @@ -21,18 +22,18 @@ new webpack.SourceMapDevToolPlugin(options);

The following options are supported:

- `test` (`string|regex|array`): Include source maps for modules based on their extension (defaults to `.js`, `.mjs`, and `.css`).
- `include` (`string|regex|array`): Include source maps for module paths that match the given value.
- `exclude` (`string|regex|array`): Exclude modules that match the given value from source map generation.
- `test` (`string` `RegExp` `[string, RegExp]`): Include source maps for modules based on their extension (defaults to `.js`, `.mjs`, and `.css`).
- `include` (`string` `RegExp` `[string, RegExp]`): Include source maps for module paths that match the given value.
- `exclude` (`string` `RegExp` `[string, RegExp]`): Exclude modules that match the given value from source map generation.
- `filename` (`string`): Defines the output filename of the SourceMap (will be inlined if no value is provided).
- `append` (`string`): Appends the given value to the original asset. Usually the `#sourceMappingURL` comment. `[url]` is replaced with a URL to the source map file. `false` disables the appending.
- `moduleFilenameTemplate` (`string`): See [`output.devtoolModuleFilenameTemplate`](/configuration/output/#outputdevtoolmodulefilenametemplate).
- `fallbackModuleFilenameTemplate` (`string`): See link above.
- `namespace` (`string`): See [`output.devtoolNamespace`](/configuration/output/#outputdevtoolnamespace).
- `module` (`boolean`): Indicates whether loaders should generate source maps (defaults to `true`).
- `columns` (`boolean`): Indicates whether column mappings should be used (defaults to `true`).
- `lineToLine` (`boolean` or `object`): Simplify and speed up source mapping by using line to line source mappings for matched modules.
- `noSources` (`boolean`): Prevents the source file content from being included in the source map (defaults to `false`).
- `module = true` (`boolean`): Indicates whether loaders should generate source maps.
- `columns = true` (`boolean`): Indicates whether column mappings should be used.
- `lineToLine` (`boolean` `object`): Simplify and speed up source mapping by using line to line source mappings for matched modules.
- `noSources = false` (`boolean`): Prevents the source file content from being included in the source map.
- `publicPath` (`string`): Emits absolute URLs with public path prefix, e.g. `https://example.com/project/`.
- `fileContext` (`string`): Makes the `[file]` argument relative to this directory.

Expand Down
10 changes: 5 additions & 5 deletions src/content/plugins/split-chunks-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ By default webpack will generate names using origin and name of the chunk (e.g.

### `splitChunks.automaticNameMaxLength`

`number: 109`
`number = 109`

Allows setting a maximum character count for chunk names that are generated by the `SplitChunksPlugin`.

### `splitChunks.chunks`

`function (chunk) | string`
`function (chunk)` `string`

This indicates which chunks will be selected for optimization. When a string is provided, valid values are `all`, `async`, and `initial`. Providing `all` can be particularly powerful, because it means that chunks can be shared even between async and non-async chunks.

Expand Down Expand Up @@ -170,7 +170,7 @@ T> `maxSize` takes higher priority than `maxInitialRequest/maxAsyncRequests`. Ac

### `splitChunks.name`

`boolean: true | function (module, chunks, cacheGroupKey):string | string`
`boolean = true` `function (module, chunks, cacheGroupKey) => string` `string`

Also available for each cacheGroup: `splitChunks.cacheGroups.{cacheGroup}.name`.

Expand Down Expand Up @@ -270,7 +270,7 @@ module.exports = {

#### `splitChunks.cacheGroups.{cacheGroup}.test`

`function (module, chunk):boolean | RegExp | string`
`function (module, chunk) => boolean` `RegExp` `string`

Controls which modules are selected by this cache group. Omitting it selects all modules. It can match the absolute module resource path or chunk names. When a chunk name is matched, all modules in the chunk are selected.

Expand Down Expand Up @@ -322,7 +322,7 @@ module.exports = {

#### `splitChunks.cacheGroups.{cacheGroup}.enforce`

`boolean: false`
`boolean = false`

Tells webpack to ignore [`splitChunks.minSize`](#splitchunksminsize), [`splitChunks.minChunks`](#splitchunksminchunks), [`splitChunks.maxAsyncRequests`](#splitchunksmaxasyncrequests) and [`splitChunks.maxInitialRequests`](#splitchunksmaxinitialrequests) options and always create chunks for this cache group.

Expand Down
3 changes: 2 additions & 1 deletion src/content/plugins/watch-ignore-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: WatchIgnorePlugin
contributors:
- skipjack
- byzyk
- EugeneHlushko
---

Ignore the specified files, i.e. those matching the provided paths or regular expressions, while in [watch mode](/configuration/watch).
Expand All @@ -14,4 +15,4 @@ new webpack.WatchIgnorePlugin(paths);

## Options

- `paths` (array): A list of RegExps or absolute paths to directories or files that should be ignored
- `paths` (`[string, RegExp]`): A list of RegExps or absolute paths to directories or files that should be ignored
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `paths` (`[string, RegExp]`): A list of RegExps or absolute paths to directories or files that should be ignored
- `paths` (`[string | RegExp]`): A list of RegExps or absolute paths to directories or files that should be ignored

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have a discussion on how to improve it outisde of this pr