Rollup plugin to precompile and resolve Handlebars templates, including support for partials, helpers, and optional rendering to jQuery collections. Current stable version is 0.4.2 (2020-09-09). The plugin integrates with Rollup's module system, allowing import of .hbs templates as ES6 modules, and precompiles templates so only the Handlebars runtime is needed. Key differentiators: includes Handlebars runtime, supports partial roots with rollup-plugin-root-import, and can render to jQuery objects directly. Requires rollup-plugin-node-resolve and rollup-plugin-commonjs for runtime support. Maintenance status: appears unmaintained since last release in 2020, with known security issues in older Handlebars versions.
npm install rollup-plugin-handlebars-plusVerified import paths — ran on the pinned version, not inferred.
Shows a basic rollup config using the plugin, importing a .hbs template and rendering it.
Migrate to @rollup/plugin-handlebars or use a different bundler plugin.
Provide handlebars option: { id: 'handlebars' } or { module: require('handlebars') }.Ensure helper modules export default function(Handlebars) { ... }.Update to >=0.4.1 which bumps handlebars dependency to 4.6.0, or provide custom handlebars via handlebars.module option.
Add plugins: nodeResolve({ browser: true }), commonjs() to your rollup config.Run: npm install handlebars
Export default function(Handlebars) { ... } from your helper module.Set partialRoot to absolute directories containing partials; also register with rollup-plugin-root-import.