Skip to content

Commit a7f8a7b

Browse files
author
Robert Jackson
authored
Merge pull request #663 from ember-cli/ensure-global-can-be-found-for-canary
Ember Ember 3.27+ can determine global for template compilation
2 parents 20184be + 5ae2db8 commit a7f8a7b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
- uses: actions/checkout@v1
9090
- uses: actions/setup-node@v1
9191
with:
92-
node-version: 12.x
92+
node-version: 10.x
9393
- name: install dependencies
9494
run: yarn install
9595
- name: test

lib/utils.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,21 @@ function getTemplateCompiler(templateCompilerPath, EmberENV = {}) {
143143
// the shared global config
144144
let clonedEmberENV = JSON.parse(JSON.stringify(EmberENV));
145145

146-
let context = vm.createContext({
146+
let sandbox = {
147147
EmberENV: clonedEmberENV,
148148
module: { require, exports: {} },
149149
require,
150-
});
150+
};
151+
152+
// if we are running on a Node version _without_ a globalThis
153+
// we must provide a `global`
154+
//
155+
// this is due to https://git.io/Jtb7s (Ember 3.27+)
156+
if (typeof globalThis === 'undefined') {
157+
sandbox.global = sandbox;
158+
}
159+
160+
let context = vm.createContext(sandbox);
151161

152162
script.runInContext(context);
153163

0 commit comments

Comments
 (0)