diff --git a/src/extras/named-register.js b/src/extras/named-register.js index 76dbe36cb..0cbd831aa 100644 --- a/src/extras/named-register.js +++ b/src/extras/named-register.js @@ -6,15 +6,15 @@ * System.register('x', ...) can be imported as System.import('x') */ (function () { + setRegisterRegistry(System); const systemJSPrototype = System.constructor.prototype; - const constructor = System.constructor; const SystemJS = function () { constructor.call(this); - this.registerRegistry = Object.create(null); + setRegisterRegistry(this); }; SystemJS.prototype = systemJSPrototype; - System = new SystemJS(); + System.constructor = SystemJS; let firstNamedDefine; @@ -22,6 +22,10 @@ firstNamedDefine = null; } + function setRegisterRegistry(systemInstance) { + systemInstance.registerRegistry = Object.create(null); + } + const register = systemJSPrototype.register; systemJSPrototype.register = function (name, deps, declare) { if (typeof name !== 'string')