-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Improve Docs #104
Closed
Improve Docs #104
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,13 +93,31 @@ Type: `function` | |
|
||
Filter out files. [more details](#hooks-options) | ||
|
||
**Use-case**: Omit [dll-chunks] ([issue](https://github.com/danethurber/webpack-manifest-plugin/issues/46)): | ||
```js | ||
filter: ({chunk, file}) => { | ||
return chunk.isInitial(); | ||
} | ||
``` | ||
You can generate additional manifest-file with a dll-chunks only using the [DllPlugin]. | ||
|
||
[dll-chunks]: https://webpack.js.org/guides/code-splitting/#dynamic-imports | ||
[DllPlugin]: https://webpack.js.org/plugins/dll-plugin/ | ||
|
||
### `options.map` | ||
|
||
Type: `function` | ||
|
||
Modify files details before the manifest is created. [more details](#hooks-options) | ||
|
||
**Use-case**: Add hash information to manifest file for [SRI] ([issue](https://github.com/danethurber/webpack-manifest-plugin/issues/35), [issue](https://github.com/danethurber/webpack-manifest-plugin/issues/55)): | ||
```js | ||
map: ({chunk, file}) => ({ file, hash: chunk.source.integrity }), | ||
generate: (seed, files) => files.reduce((manifest, {name, path}) => manifest), seed), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that is working? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure too 😂 after:
default generate is:
|
||
``` | ||
|
||
[SRI]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity | ||
|
||
### `options.sort` | ||
|
||
Type: `function` | ||
|
@@ -111,12 +129,14 @@ Sort files before they are passed to `generate`. [more details](#hooks-options) | |
Type: `function`<br> | ||
Default: `(seed, files) => files.reduce((manifest, {name, path}) => ({...manifest, [name]: path}), seed)` | ||
|
||
All entries in `files` correspond to the object structure described in the `Hooks Options` section. | ||
All entries in `files` correspond to the object structure described in the `emit Hook Options` section. | ||
|
||
Create the manifest. It can return anything as long as it's serialisable by `JSON.stringify`. [more details](#hooks-options) | ||
|
||
**Use-case**: topological sort ([example](https://github.com/danethurber/webpack-manifest-plugin/pull/93)) | ||
|
||
|
||
## Hooks Options | ||
## `emit` Hook Options | ||
|
||
`filter`, `map`, `sort` takes as an input an Object with the following properties: | ||
|
||
|
@@ -158,6 +178,24 @@ Type: `Boolean` | |
|
||
Is required by a module. Cannot be `true` if `isAsset` is `false`. | ||
|
||
## `webpack-manifest-plugin-after-emit` Hook | ||
|
||
Hook allows other plugins to use the manifest. | ||
Look at [patch](https://github.com/danethurber/webpack-manifest-plugin/pull/76) and [spec](https://github.com/danethurber/webpack-manifest-plugin/blob/34257bc2da17c6f18ab64c4db938993d6143be47/spec/plugin.integration.spec.js#L68) for more details. | ||
|
||
There are some arguments: | ||
|
||
### `manifest` | ||
|
||
Type: `Object` | ||
|
||
Generated manifest. | ||
|
||
### `next` | ||
|
||
Type: `Function` | ||
|
||
Callback that is for continuing execution flow. | ||
|
||
## License | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not specific to dll chunks, also dynamic one (when you use
import(...).then(...)
)