From d9a83a4ba5f11347fb443ed7f08a3b4cfdb5ffe4 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 22 Oct 2021 00:31:02 -0400 Subject: [PATCH] Don't pass falsy `locals` to glimmer precompile Fixes #19797. --- .../lib/system/compile-options.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/ember-template-compiler/lib/system/compile-options.ts b/packages/ember-template-compiler/lib/system/compile-options.ts index 37f660d3dfe..22e77714340 100644 --- a/packages/ember-template-compiler/lib/system/compile-options.ts +++ b/packages/ember-template-compiler/lib/system/compile-options.ts @@ -35,6 +35,15 @@ export function buildCompileOptions(_options: EmberPrecompileOptions): EmberPrec options.locals = undefined; } + if ('locals' in options && !options.locals) { + // Glimmer's precompile options declare `locals` like: + // locals?: string[] + // but many in-use versions of babel-plugin-htmlbars-inline-precompile will + // set locals to `null`. This used to work but only because glimmer was + // ignoring locals for non-strict templates, and now it supports that case. + delete options.locals; + } + // move `moduleName` into `meta` property if (options.moduleName) { let meta = options.meta;