Registry /
devops / esbuild-plugin-handlebars
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
muslnode 18–223 runs
build_error
glibcnode 18–223 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: {}
})],
});
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-plugin-handlebars'
Package not installed or not in node_modules.
fixRun '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.
fixUse 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.
fixEnsure you call the default export as a function: plugins: [handlebarsPlugin()]
Audit
Dependencies
esbuildrequiredPeer dependency required to use the plugin.
handlebarsrequiredRequired at runtime for template compilation.