Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@craftamap/esbuild-plugin-html
Advanced tools
`@craftamap/esbuild-plugin-html` is a plugin to generate HTML files with [esbuild](https://esbuild.github.io/). All specified entry points, and their related files (such as `.css`-files) are automatically injected into the HTML file. `@craftamap/esbuild-p
@craftamap/esbuild-plugin-html
is a plugin to generate HTML files with esbuild.
All specified entry points, and their related files (such as .css
-files) are automatically injected into the HTML file.
@craftamap/esbuild-plugin-html
is inspired by jantimon/html-webpack-plugin.
This plugin was developed against esbuild
v0.12.26, using node 16 (<= 14 should work, though).
yarn add -D @craftamap/esbuild-plugin-html
# or
npm install --save-dev @craftamap/esbuild-plugin-html
@craftamap/esbuild-plugin-html
requires to have some options set in your esbuild script:
outdir
must be set.metafile
must be set to true
.Your configuration file might looks like this:
const esbuild = require('esbuild');
const { htmlPlugin } = require('@craftamap/esbuild-plugin-html');
const options = {
entryPoints: ['src/index.jsx'],
bundle: true,
metafile: true, // needs to be set
outdir: 'dist/', // needs to be set
plugins: [
htmlPlugin({
files: [
{
entryPoints: [
'src/index.jsx',
],
filename: 'index.html',
htmlTemplate: `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="root">
</div>
</body>
</html>
`,
},
]
})
]
}
esbuild.build(options).catch(() => process.exit(1))
interface Configuration {
files: HtmlFileConfiguration[],
}
interface HtmlFileConfiguration {
filename: string, // Output filename, e.g. index.html
entryPoints: string[], // Entry points to inject into the html, e.g. ['src/index.jsx']
title?: string, // title to inject into the head, will not be set if not specified
htmlTemplate?: string, // custom html document template string, a default template will be used if not specified
scriptLoading?: 'blocking' | 'defer' | 'module', // Decide if the script tag will be inserted as blocking script tag, `defer=""` (default) or with `type="module"`
}
*.html
-PluginsThere exist some other *.html
-plugins for esbuild. Those work differently than @craftamap/esbuild-plugin-html
, and might be a better fit for you:
*.html
-file as entry point, and start subprocesses with esbuild
)FAQs
[![npm](https://img.shields.io/npm/v/@craftamap/esbuild-plugin-html?color=green&style=flat-square)](https://www.npmjs.com/package/@craftamap/esbuild-plugin-html)
The npm package @craftamap/esbuild-plugin-html receives a total of 12,268 weekly downloads. As such, @craftamap/esbuild-plugin-html popularity was classified as popular.
We found that @craftamap/esbuild-plugin-html 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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.