SystemJS newModule () with class (function) not object

I have several global classes (JS classes with prototype syntax) that need to be manually added to the registry using System.set (moduleName, Module). Since the second parameter is of type Module, I need to use System.newModule (object).

But, if I pass a non-object to System.newModule (), it throws - Uncropping TypeError: Expected object.

Am I doing it wrong? Is there any other way to do this?

+3


source to share


1 answer


System.set(System.normalizeSync('./something'), System.newModule({
  __useDefault: function() {
      console.log('do stuff');
  }
}));

      



Basically all you have to do is specify your function / non-object as defined in the de-currency key and use the option: __useDefault: true

+1


source







All Articles