Skip to content

Commit 804ca79

Browse files
authored
fix: update variable declaration to use globalThis for $templates (#14)
1 parent ce36fb1 commit 804ca79

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/code-generator-dynamic-impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class DynamicCodeGenerator implements CodeGenerator, SourceBuilder {
109109
110110
"use strict";
111111
112-
var $templates = {
112+
globalThis.$templates = {
113113
`;
114114
for (const [name, template] of repo.templates) {
115115
contents += ` ${JSON.stringify(name)}: function(param, variable, shader_helper) {

test/testcases/build-basic/expected/dynamic/templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"use strict";
44

5-
var $templates = {
5+
globalThis.$templates = {
66
"shader/triangle.wgsl.template": function(param, variable, shader_helper) {
77
var $emitAdditional = function (code) {
88
shader_helper.appendAdditionalImplementation(code);

test/testcases/build-example-pad/expected/dynamic/templates.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"use strict";
44

5-
var $templates = {
5+
globalThis.$templates = {
66
"tensor/pad.wgsl.template": function(param, variable, shader_helper) {
77
var $emitAdditional = function (code) {
88
shader_helper.appendAdditionalImplementation(code);

0 commit comments

Comments
 (0)