Registry / web-framework / ember-cli-htmlbars

ember-cli-htmlbars

JSON →
library7.0.1jsnpmunverified

An Ember CLI addon that compiles Handlebars/HTMLBars templates into JavaScript functions using the Glimmer VM. Current stable version is 7.0.1 (March 2026). It integrates with Ember's build pipeline, supporting AST transforms, custom template compilers, and dependency invalidation. It requires Ember.js v4.12+ and Node.js 20+. Key differentiators: tight integration with Ember CLI, first-party support for addon template compilation, and advanced AST plugin system.

npm install ember-cli-htmlbars
INSTALL
IMPORT
SIG · EMBER-CLI-HTMLBARS
E
ember-cli-htmlbars
web-frameworkjavascriptv7.0.1
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 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

default
import HtmlbarsCompiler from 'ember-cli-htmlbars'
const HtmlbarsCompiler = require('ember-cli-htmlbars').default
Default export is the Broccoli plugin class. In TypeScript, use import statement; no .default needed.
TemplateFactory
import { TemplateFactory } from 'ember-cli-htmlbars'
const { TemplateFactory } = require('ember-cli-htmlbars')
Named export available in v6.3.0+. Not user-constructible; used for typing.
type TemplateFactory
import type { TemplateFactory } from 'ember-cli-htmlbars'
import { TemplateFactory } from 'ember-cli-htmlbars' (runtime import)
If only using for type annotations, use import type to avoid side effects.

Shows how to register an AST transform plugin in an Ember addon using ember-cli-htmlbars.

// Use ember-cli-htmlbars via Ember CLI build pipeline // No direct import needed in app code; addon is picked up automatically. // To register an AST transform in an addon: import SomeTransform from './some-path/transform'; export default { name: 'my-addon', included() { this._super.included.apply(this, arguments); this.app.registry.add('htmlbars-ast-plugin', { name: 'some-transform', plugin: SomeTransform, baseDir() { return __dirname; }, cacheKey() { return SomeTransform.cacheKey; } }); } };
Debug
Known issues
breakingVersion 7.0.0 dropped support for Node < 18 and Ember < 4.12.
fix
Upgrade Node.js to >=18 and Ember.js to >=4.12.
affects: <7.0.0
breakingVersion 7.0.0 updated minimum Node version to 20.
fix
Upgrade Node.js to >=20.
affects: <7.0.0
breakingVersion 6.0.0 simplified babel plugin usage, dropping support for ember < 3.27.
fix
Upgrade Ember to >=3.27. If on older Ember, stay on v5.x.
affects: <6.0.0
gotchaWhen registering AST plugins, do not call `new` on the plugin function; pass it directly.
fix
Use `plugin: SomeTransform` not `plugin: new SomeTransform()`.
affects: >=1.0.0
gotchaIn TypeScript, `TemplateFactory` type cannot be constructed; use only for type annotations.
fix
Use `import type { TemplateFactory } from 'ember-cli-htmlbars'` to avoid runtime errors.
affects: >=6.3.0
deprecatedCustom template compiler path via `templateCompilerPath` option is deprecated since v6.
fix
Use `babel-plugin-ember-template-compilation` or upgrade to new simplified pipeline.
affects: >=6.0.0
Errors
Common errors & fixes
TypeError: this.app.registry.add is not a function
`included` hook called before `this._super.included`
fix
Ensure `this._super.included.apply(this, arguments)` is called before accessing `this.app.registry`.
Cannot find module 'ember-cli-htmlbars'
Package not installed or not in `devDependencies`
fix
Run `npm install --save-dev ember-cli-htmlbars` or `yarn add --dev ember-cli-htmlbars`.
Error: Template compilation failed: Unexpected token
AST transform plugin returns invalid Handlebars AST
fix
Ensure the AST transform returns a valid node or use Glimmer/HTMLBars transformer API.
TypeError: (0 , _emberCliHtmlbars.default) is not a function
Using CommonJS require with a default import in ESM project
fix
Use `import HtmlbarsCompiler from 'ember-cli-htmlbars'` instead of `require`.
Upgrade
Version history
7.0.1latest on npm
Audit
Dependencies
@babel/corerequiredRequired for Babel transformation
ember-sourcerequiredRequired as peer dependency for template compilation
babel-plugin-ember-template-compilationoptionalUsed for simplified template compilation on Ember 3.27+
Agent activity
2 hits · last 30 days
node
2
Resources