{"id":22050,"library":"rollup-plugin-handlebars","title":"rollup-plugin-handlebars","description":"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.","status":"abandoned","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/jibhaine/rollup-plugin-handlebars","tags":["javascript","rollup-plugin","es2015","handlebars","hbs","template"],"install":[{"cmd":"npm install rollup-plugin-handlebars","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-handlebars","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-handlebars","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency for compiled templates","package":"handlebars","optional":false},{"reason":"Used for filter and other utilities","package":"rollup-pluginutils","optional":true}],"imports":[{"note":"Plugin exports a default function; named import will not work.","wrong":"import { handlebars } from 'rollup-plugin-handlebars';","symbol":"handlebars (default)","correct":"import handlebars from 'rollup-plugin-handlebars';"},{"note":"CommonJS require returns the default export directly.","wrong":"const { handlebars } = require('rollup-plugin-handlebars');","symbol":"handlebars (require)","correct":"const handlebars = require('rollup-plugin-handlebars');"},{"note":"When using ESM, import Handlebars runtime for any helpers or partials.","wrong":"const Handlebars = require('handlebars');","symbol":"Handlebars runtime","correct":"import Handlebars from 'handlebars';"}],"quickstart":{"code":"// rollup.config.js\nimport handlebars from 'rollup-plugin-handlebars';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'cjs'\n  },\n  plugins: [\n    handlebars()\n  ]\n};\n\n// src/template.hbs\n<h1>{{title}}</h1>\n\n// src/index.js\nimport tmpl from './template.hbs';\nconsole.log(tmpl({ title: 'Hello' }));","lang":"javascript","description":"Demonstrates Rollup config with handlebars plugin and importing .hbs template as compiled function."},"warnings":[{"fix":"Switch to @rollup/plugin-handlebars or use a different plugin.","message":"Plugin only supports Rollup v0.x (pre-1.0). Not compatible with rollup >= 1.0 due to plugin API changes.","severity":"breaking","affected_versions":"rollup >= 1.0"},{"fix":"Ensure handlebars is installed as a dependency (not devDependency) or externalize the runtime.","message":"Handlebars runtime must be present in final bundle. Templates compile to functions that call Handlebars.runtime functions.","severity":"gotcha","affected_versions":">=0.0"},{"fix":"Migrate to an alternative that doesn't depend on rollup-pluginutils.","message":"Plugin uses deprecated rollup-pluginutils package. Future Rollup breaking changes may cause failures.","severity":"deprecated","affected_versions":">=0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Add `import handlebars from 'rollup-plugin-handlebars'` and include in `plugins` array.","cause":"Plugin not installed or not included in rollup config.","error":"Error: No plugin known for extension: .hbs"},{"fix":"Run `npm install rollup-plugin-handlebars --save-dev` (or yarn equivalent).","cause":"Package not installed.","error":"Error: Cannot find module 'rollup-plugin-handlebars'"},{"fix":"Use `import handlebars from 'rollup-plugin-handlebars';` (without curly braces).","cause":"Named import used instead of default import.","error":"Error: 'default' is not exported by rollup-plugin-handlebars"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}