- 0133技术站
- 联系QQ:18840023
- QQ交流群

- 微信公众号

该插件会根据模块的相对路径生成一个四位数的hash作为模块id, 建议用于生产环境。
new webpack.HashedModuleIdsPlugin({ // 参数... })
该插件支持以下参数:
hashFunction
: 散列算法,默认为 'md5'。支持 Node.JS crypto.createHash
的所有功能。hashDigest
: 在生成 hash 时使用的编码方式,默认为 'base64'。支持 Node.js hash.digest
的所有编码。hashDigestLength
: 散列摘要的前缀长度,默认为 4。下面是使用该插件的例子:
new webpack.HashedModuleIdsPlugin({ hashFunction: 'sha256', hashDigest: 'hex', hashDigestLength: 20})
推荐手册