rollup-plugin-glimmer-template-tag

raw JSON →
0.4.1 verified Mon Apr 27 auth: no javascript

A Rollup plugin for compiling `<template>` tags in `.gjs` and `.gts` files used by Ember.js v2 addons. Version 0.4.1 requires Node 16+ and Rollup 3+. It is ESM-only and must be paired with Babel's `ember-template-imports` plugin. Key differentiator: it enables the new Ember `<template>` tag syntax in build pipelines, handling both JavaScript and TypeScript via separate transforms with `rollup-plugin-ts`.

error require() of ES Module not supported
cause Using CommonJS require with ESM-only package
fix
Change to import { glimmerTemplateTag } from 'rollup-plugin-glimmer-template-tag' in .mjs file.
error Template tag not transformed: unexpected token '<'
cause Missing Babel plugin 'ember-template-imports'
fix
Add 'ember-template-imports/src/babel-plugin' to Babel plugins list.
error ts(2307) Cannot find module '...' or its corresponding type declarations.
cause TypeScript declaration errors from template not being transpiled yet
fix
Set transpileOnly: true in rollup-plugin-ts configuration.
breaking ESM-only: CommonJS require will fail
fix Convert config to ESM (.mjs) or use dynamic import().
gotcha Must add Babel plugin 'ember-template-imports/src/babel-plugin' in babel.config.js
fix Add the plugin to your Babel configuration as shown in the README.
gotcha With TypeScript, need to set transpileOnly: true in rollup-plugin-ts
fix Set typescript({ transpiler: 'babel', transpileOnly: true }) in rollup config.
gotcha Type errors from <template> are copied into generated .d.ts files, causing downstream errors
fix Run type-checking separately via glint; ensure source files have no type errors.
deprecated Node 16 EOL; future versions may drop support
fix Upgrade to Node 18 or 20.
npm install rollup-plugin-glimmer-template-tag
yarn add rollup-plugin-glimmer-template-tag
pnpm add rollup-plugin-glimmer-template-tag

Shows basic Rollup configuration to add `<template>` support for gjs/gts files.

// rollup.config.mjs
import { glimmerTemplateTag } from 'rollup-plugin-glimmer-template-tag';

export default {
  plugins: [
    glimmerTemplateTag(),
    // ... other plugins
  ]
};