Registry / devops / esbuild-plugin-handlebars

esbuild-plugin-handlebars

JSON →
library1.0.3jsnpmunverified

An esbuild plugin that precompiles Handlebars templates during the build process. Current stable version is 1.0.3. It integrates with esbuild's plugin system to handle .hbs files, allowing you to bundle Handlebars templates into your output. Compared to other Handlebars loaders, it is lightweight and focused on esbuild, with options for additional helpers, partials, and precompile options. The package has a simple API and is published on npm with regular maintenance.

npm install esbuild-plugin-handlebars
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-HAN
E
esbuild-plugin-handlebars
devopsjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import handlebarsPlugin from 'esbuild-plugin-handlebars'
const handlebarsPlugin = require('esbuild-plugin-handlebars')
This package is ESM-only. Use import syntax or dynamic import().
handlebarsPlugin (as named import)
import { handlebarsPlugin } from 'esbuild-plugin-handlebars'
const { handlebarsPlugin } = require('esbuild-plugin-handlebars')
Named export available as alternative to default import.
HandlebarsOptions (type)
import type { HandlebarsOptions } from 'esbuild-plugin-handlebars'
TypeScript users can import the options type for type safety.

Sets up esbuild with the Handlebars plugin, bundling a JavaScript entry point that imports .hbs templates.

import esbuild from 'esbuild'; import handlebarsPlugin from 'esbuild-plugin-handlebars'; await esbuild.build({ entryPoints: ['src/index.js'], outfile: 'dist/bundle.js', bundle: true, plugins: [handlebarsPlugin({ additionalHelpers: {}, additionalPartials: {}, precompileOptions: {} })], });
Debug
Known issues
gotchaIf you use CommonJS require(), the import will fail because the package is ESM-only.
fix
Use dynamic import() or switch to ESM. For Node.js, set "type": "module" in package.json.
affects: >=1.0.0
deprecatedNo deprecated features at this time.
fix
N/A
affects: >=0.0.0
breakingNo breaking changes in version 1.0.3.
fix
N/A
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-plugin-handlebars'
Package not installed or not in node_modules.
fix
Run 'npm install esbuild-plugin-handlebars --save-dev' or 'yarn add -D esbuild-plugin-handlebars'.
TypeError: esbuild_plugin_handlebars_1.default is not a function
Using CommonJS require() on an ESM-only package.
fix
Use import statement or dynamic import().
Error: The plugin 'esbuild-plugin-handlebars' is not a function or object
Incorrect usage of the plugin in esbuild config.
fix
Ensure you call the default export as a function: plugins: [handlebarsPlugin()]
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency required to use the plugin.
handlebarsrequiredRequired at runtime for template compilation.
Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-handlebars — npm install esbuild-plugin-handlebars · libregistry