From b97ad948a9dbbb9e2dd45581d0eea3fe7e5476bb Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Wed, 3 Mar 2021 16:57:37 -0500 Subject: [PATCH] Make `setTimeout`/`clearTimeout` available to the template compiler sandbox --- lib/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index 47dce06e..9aec3b15 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -132,6 +132,13 @@ function getTemplateCompiler(templateCompilerPath, EmberENV = {}) { let sandbox = { EmberENV: clonedEmberENV, + + // Older versions of ember-template-compiler (up until ember-source@3.1.0) + // eagerly access `setTimeout` without checking via `typeof` first + setTimeout, + clearTimeout, + + // fake the module into thinking we are running inside a Node context module: { require, exports: {} }, require, };