Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
esbuild-html-plugin
Advanced tools
An esbuild plugin that generates an HTML file by providing access to the output URLs of the bundled assets while allowing customization of head and body elements. Minification is controlled by esbuild's
minify
option.
npm install esbuild-html-plugin
import * as esbuild from 'esbuild';
await esbuild.build({
entryPoints: [`app.ts`],
bundle: true,
minify: true,
outdir: `dist`,
publicPath: `/static`,
plugins: [
htmlPlugin({
outfile: `index.html`,
createBodyElements: (outputUrls) =>
outputUrls
.filter((outputUrl) => outputUrl.endsWith(`.js`))
.map((outputUrl) => `<script src="${outputUrl}"></script>`),
}),
],
});
outfile
(required)The output file's name for the generated HTML. This name will be combined with
the outdir
or the dirname of the outfile
from the esbuild options.
{
outfile: `index.html`,
}
language
(optional)The language attribute for the HTML tag.
{
language: `en`,
}
createHeadElements
(optional)A function that receives the output URLs of the bundled assets and returns an array of strings representing the custom head elements.
{
createHeadElements: (outputUrls) =>
outputUrls
.filter((outputUrl) => outputUrl.endsWith(`.css`))
.map((outputUrl) => `<link rel="stylesheet" href="${outputUrl}">`),
}
createBodyElements
(optional)A function that receives the output URLs of the bundled assets and returns an array of strings representing the custom body elements.
{
createBodyElements: (outputUrls) =>
outputUrls
.filter((outputUrl) => outputUrl.endsWith(`.js`))
.map((outputUrl) => `<script src="${outputUrl}"></script>`),
}
FAQs
An esbuild plugin that generates an HTML file.
The npm package esbuild-html-plugin receives a total of 3 weekly downloads. As such, esbuild-html-plugin popularity was classified as not popular.
We found that esbuild-html-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.