Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hash-content-html-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hash-content-html-webpack-plugin - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

README.md

7

package.json
{
"name": "hash-content-html-webpack-plugin",
"version": "1.0.0",
"version": "1.1.0",
"description": "",

@@ -10,3 +10,6 @@ "main": "src/index.js",

"author": "",
"license": "MIT"
"license": "MIT",
"dependencies": {
"hasha": "^3.0.0"
}
}

@@ -1,1 +0,28 @@

const test = 1
const hasha = require('hasha')
module.exports = class ContentHash {
apply(compiler) {
compiler.plugin('compilation', (compilation) => {
compilation.plugin(
'html-webpack-plugin-after-emit',
({ outputName, html }) => {
const chunk = compilation.assets[outputName]
const hash = hasha(html.source(), {
algorithm: 'md5'
}).substring(0, 20)
const name = outputName.replace(/\[contenthash\]/g, hash)
compilation.assets[name] = chunk
delete compilation.assets[outputName]
}
)
})
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc