Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@craftamap/esbuild-plugin-html
Advanced tools
[![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)
@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 9,248 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.