From da5a0f1db4111eb05a34b12bd947e690d5b71aae Mon Sep 17 00:00:00 2001 From: kumavis Date: Wed, 5 Mar 2025 11:37:04 -1000 Subject: [PATCH] feat: use globalThis shim --- lib/ejs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ejs.js b/lib/ejs.js index 1153b53f..e92a7730 100755 --- a/lib/ejs.js +++ b/lib/ejs.js @@ -49,6 +49,7 @@ var fs = require('fs'); var path = require('path'); var utils = require('./utils'); +var GLOBAL_THIS = typeof globalThis !== 'undefined' ? globalThis : (new Function('return this;'))(); var scopeOptionWarned = false; /** @type {string} */ var _VERSION_STRING = require('../package.json').version; @@ -106,7 +107,7 @@ exports.localsName = _DEFAULT_LOCALS_NAME; * @public */ -exports.promiseImpl = (new Function('return this;'))().Promise; +exports.promiseImpl = GLOBAL_THIS.Promise; /** * Get the path to the included file from the parent file path and the