Skip to content

Commit

Permalink
Do not assume global variables are assigned to self. (#205)
Browse files Browse the repository at this point in the history
Do not assume global variables are assigned to `self`.
  • Loading branch information
rwjblue committed Nov 2, 2019
2 parents 6563435 + 8a0dff8 commit 3c0e3ff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion addon/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
declare global {
var requirejs: {
_eak_seen: Object;
};
}

import Engine from '@ember/engine';
import require from 'require';

Expand Down Expand Up @@ -39,7 +45,7 @@ export default function loadInitializers(app: typeof Engine, prefix: string): vo
var instanceInitializers = [];
// this is 2 pass because generally the first pass is the problem
// and is reduced, and resolveInitializer has potential to deopt
var moduleNames = Object.keys(self.requirejs._eak_seen);
var moduleNames = Object.keys(requirejs._eak_seen);
for (var i = 0; i < moduleNames.length; i++) {
var moduleName = moduleNames[i];
if (moduleName.lastIndexOf(initializerPrefix, 0) === 0) {
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
"release-it-lerna-changelog": "^1.0.3",
"typescript": "^3.6.3"
},
"resolutions": {
"**/engine.io": "~3.3.0"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
},
Expand Down

0 comments on commit 3c0e3ff

Please sign in to comment.