
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
html-webpack-injector
Advanced tools
[![npm][npm]][npm-url]
Plugin that simplifies injection of chunks into head and body using HtmlWebpackPlugin
npm i --save-dev html-webpack-injector
yarn add --dev html-webpack-injector
This is a webpack plugin that simplifies injection of chunks in head
and body
tags of HTML files using HtmlWebpackPlugin
to serve your webpack
bundles. This is especially useful when you want to inject some chunks to head and some chunks to body using HtmlWebpackPlugin.
The html-webpack-injector
works without configuration.
_head
after the name of the bundles you want to inject in the head
section.body
tag.The html-webpack-injector
is based on the hooks provided by HtmlWebpackPlugin.
webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackInjector = require('html-webpack-injector');
module.exports = {
entry: {
index: "./index.ts",
index_head: "./index.css" // add "_head" at the end to inject in head.
},
output: {
path: "./dist",
filename: "[name].bundle.js"
},
plugins: [
new HtmlWebpackPlugin({
template: "./index.html",
filename: "./dist/index.html",
chunks: ["index", "index_head"]
}),
new HtmlWebpackInjector()
]
}
This will generate a file dist/index.html
containing the following
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Webpack App</title>
<script type="text/javascript" src="index_head.bundle.js"></script></head>
</head>
<body>
<script src="index_bundle.js"></script>
</body>
</html>
You have to add _head
in the entry point chunk name and it will be automatically injected in the head.
FAQs
Helps to inject chunks to head and body via HtmlWebpackPlugin with additional options to add async/defer to chunks
The npm package html-webpack-injector receives a total of 11,865 weekly downloads. As such, html-webpack-injector popularity was classified as popular.
We found that html-webpack-injector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.