Skip to content

Commit 976d08b

Browse files
authored
docs(plugins): Add missing context option (#3666)
* docs(HashedModuleIdsPlugin): add missing context option * docs: add my username to Contributors * docs: clarify that context is an absolute path
1 parent f0102a8 commit 976d08b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/content/plugins/hashed-module-ids-plugin.md

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: HashedModuleIdsPlugin
33
contributors:
44
- shaodahong
55
- byzyk
6+
- EslamHiko
67
---
78

89
This plugin will cause hashes to be based on the relative path of the module, generating a four character string as the module id. Suggested for use in production.
@@ -18,6 +19,7 @@ new webpack.HashedModuleIdsPlugin({
1819

1920
This plugin supports the following options:
2021

22+
- `context`: The context directory (__absolute path__) for creating names.
2123
- `hashFunction`: The hashing algorithm to use, defaults to `'md4'`. All functions from Node.JS' [`crypto.createHash`](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options) are supported.
2224
- `hashDigest`: The encoding to use when generating the hash, defaults to `'base64'`. All encodings from Node.JS' [`hash.digest`](https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding) are supported.
2325
- `hashDigestLength`: The prefix length of the hash digest to use, defaults to `4`. Note that some generated ids might be longer than specified here, to avoid module id collisions.
@@ -29,6 +31,7 @@ Here's an example of how this plugin might be used:
2931

3032
``` js
3133
new webpack.HashedModuleIdsPlugin({
34+
context: __dirname,
3235
hashFunction: 'sha256',
3336
hashDigest: 'hex',
3437
hashDigestLength: 20

0 commit comments

Comments
 (0)