emberjs/ember.js · error · Error

Attempted to call `compileTemplate` without first loading th

Error message

Attempted to call `compileTemplate` without first loading the runtime template compiler.

What it means

Error "Attempted to call `compileTemplate` without first loading the runtime template compiler." thrown in emberjs/ember.js.

Source

Thrown at packages/@ember/template-compilation/index.ts:25

// which makes that work. However, in practice it is supplied by the build,
// *for* the build, and will *not* be present at runtime, so the actual value
// here is `undefined` in prod; in dev it is a function which throws a somewhat
// nicer error. This is janky, but... here we are.
interface PrecompileTemplate {
  (
    templateString: string,
    options?: {
      strictMode?: boolean;
      scope?: () => Record<string, unknown>;
      moduleName?: string;
    }
  ): TemplateFactory;
}

export let __emberTemplateCompiler: undefined | typeof ETC;
export const compileTemplate: typeof ETC.compile = (...args: Parameters<typeof ETC.compile>) => {
  if (!__emberTemplateCompiler) {
    throw new Error(
      'Attempted to call `compileTemplate` without first loading the runtime template compiler.'
    );
  }
  return __emberTemplateCompiler.compile(...args);
};

export let precompileTemplate: PrecompileTemplate;

if (DEBUG) {
  precompileTemplate = () => {
    throw new Error(
      'Attempted to call `precompileTemplate` at runtime, but this API is meant to be used at compile time. You should use `compileTemplate` instead.'
    );
  };
}

export function __registerTemplateCompiler(c: typeof ETC) {
  __emberTemplateCompiler = c;

View on GitHub (pinned to 26f97246a8)

When it happens

Trigger: Thrown at packages/@ember/template-compilation/index.ts:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of emberjs/ember.js@26f97246a8 (2026-09-01). Data as JSON: /api/errors/b9f66f20c8e08a38. Report an issue: GitHub.