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

html-webpack-injector

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-webpack-injector - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

yarn.lock

39

index.js

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

const HtmlWebpackPlugin = require("html-webpack-plugin");
class HtmlWebpackInjectorPlugin {
apply(compiler) {
compiler.plugin("compilation", compilation => {
compilation.plugin("html-webpack-plugin-alter-asset-tags", object => {
const chunks = [...object.head, ...object.body];
const headChunks = [];
const bodyChunks = [];
compiler.hooks.compilation.tap('HtmlWebpackInjectorPlugin', (compilation) => {
HtmlWebpackPlugin.getHooks(compilation).alterAssetTagGroups.tapAsync(
'HtmlWebpackInjectorPlugin',
(data, callback) => {
const chunks = [...data.headTags, ...data.bodyTags];
const headChunks = [];
const bodyChunks = [];
chunks.forEach(chunk => {
if (chunk.attributes.src.includes("_head")) {
headChunks.push(chunk);
} else {
bodyChunks.push(chunk);
}
});
chunks.forEach(chunk => {
if (chunk.attributes.src.includes("_head")) {
headChunks.push(chunk);
} else {
bodyChunks.push(chunk);
}
});
object.head = headChunks;
object.body = bodyChunks;
});
});
data.headTags = headChunks;
data.bodyTags = bodyChunks;
callback(null, data)
}
)
})
}

@@ -22,0 +29,0 @@ }

{
"name": "html-webpack-injector",
"version": "1.0.3",
"version": "1.0.4",
"description": "Helps to inject chunks to head and body via HtmlWebpackPlugin",

@@ -16,3 +16,6 @@ "main": "index.js",

"author": "Archit garg <thearchitgargg@gmail.com> (https://github.com/thearchitgarg)",
"license": "ISC"
"license": "ISC",
"devDependencies": {
"html-webpack-plugin": "4.0.0-beta.5"
}
}
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