Registry / web-framework / rollup-plugin-handlebars

rollup-plugin-handlebars

JSON →
library1.0.0jsnpmunverified

A Rollup plugin that compiles Handlebars templates (.hbs) to JavaScript functions during the bundling process. Version 1.0.0 is the latest stable release, published only once in 2017. It allows importing .hbs files directly as template functions, with support for Handlebars compile options. Key limitation: no longer maintained, incompatible with modern Rollup v2+, and no TypeScript support.

npm install rollup-plugin-handlebars
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-HAND
R
rollup-plugin-handlebars
web-frameworkjavascriptv1.0.0
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.

handlebars (default)
import handlebars from 'rollup-plugin-handlebars';
import { handlebars } from 'rollup-plugin-handlebars';
Plugin exports a default function; named import will not work.
handlebars (require)
const handlebars = require('rollup-plugin-handlebars');
const { handlebars } = require('rollup-plugin-handlebars');
CommonJS require returns the default export directly.
Handlebars runtime
import Handlebars from 'handlebars';
const Handlebars = require('handlebars');
When using ESM, import Handlebars runtime for any helpers or partials.

Demonstrates Rollup config with handlebars plugin and importing .hbs template as compiled function.

// rollup.config.js import handlebars from 'rollup-plugin-handlebars'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'cjs' }, plugins: [ handlebars() ] }; // src/template.hbs <h1>{{title}}</h1> // src/index.js import tmpl from './template.hbs'; console.log(tmpl({ title: 'Hello' }));
Debug
Known issues
breakingPlugin only supports Rollup v0.x (pre-1.0). Not compatible with rollup >= 1.0 due to plugin API changes.
fix
Switch to @rollup/plugin-handlebars or use a different plugin.
affects: rollup >= 1.0
gotchaHandlebars runtime must be present in final bundle. Templates compile to functions that call Handlebars.runtime functions.
fix
Ensure handlebars is installed as a dependency (not devDependency) or externalize the runtime.
affects: >=0.0
deprecatedPlugin uses deprecated rollup-pluginutils package. Future Rollup breaking changes may cause failures.
fix
Migrate to an alternative that doesn't depend on rollup-pluginutils.
affects: >=0.0
Errors
Common errors & fixes
Error: No plugin known for extension: .hbs
Plugin not installed or not included in rollup config.
fix
Add `import handlebars from 'rollup-plugin-handlebars'` and include in `plugins` array.
Error: Cannot find module 'rollup-plugin-handlebars'
Package not installed.
fix
Run `npm install rollup-plugin-handlebars --save-dev` (or yarn equivalent).
Error: 'default' is not exported by rollup-plugin-handlebars
Named import used instead of default import.
fix
Use `import handlebars from 'rollup-plugin-handlebars';` (without curly braces).
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
handlebarsrequiredRuntime peer dependency for compiled templates
rollup-pluginutilsoptionalUsed for filter and other utilities
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-handlebars — npm install rollup-plugin-handlebars · libregistry