Skip to content

Overriding System Loader behavior

kpullen edited this page Nov 29, 2014 · 4 revisions

To supply new functions for System functions, extend TraceurLoader and override the functions normalize, locate, fetch, translate or instantiate. The first three are supported and we'll fix any bugs against them. The translate and instantiate are called but probably don't do what the standard expects.

For example, you might do something like

import {webLoader} from './webLoader';
class MyLoader extends TraceurLoader {
  constructor() {
     super(webLoader, window.location.href);
  }
  normalize(name) {
    // bah I am normal!
    return name;
  }
}

System = new MyLoader();

Clone this wiki locally