@atlassian/soy-loader - generated namespace not exposed to window

Hi :wave:

We’re currently trying to migrate from atlassian-soy-cli to @atlassian/soy-loader. The generated code looks like this:

// Exposed to window by expose-soy
window.RWJS = window.RWJS || {};
// This file was automatically generated from template11.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace RWJS.Templates.Dialogs.
 */

if (typeof RWJS == 'undefined') { var RWJS = {}; }
if (typeof RWJS.Templates == 'undefined') { RWJS.Templates = {}; }
if (typeof RWJS.Templates.Dialogs == 'undefined') { RWJS.Templates.Dialogs = {}; }

...
...

First it creates an RWJS object in window if none exist, which is great; but then it creates another with global scope:

if (typeof RWJS == 'undefined') { var RWJS = {}; }

From then on, all our soy templates (RWJS.Templates.Buttons, RWJS.Templates.Dialogs etc.) are added to this object and window.RWJS doesn’t receive any of it:
Screenshot 2021-10-05 at 08.23.47

Completely lost as to how to proceed from here. Any ideas?

Hi @potatocabbage, could you create a bug ticket in ecosystem Jira?
https://ecosystem.atlassian.net/jira/software/c/projects/SPFE/issues/

Providing a partial source of your soy template and the loader configuration you are using will help us reproduce the bug.

Thanks,
Maciej Adamczak
Atlassian Developer