Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #348 from bitovi/check-transpiler-ran
Browse files Browse the repository at this point in the history
Track whether transpiler has ran with a flag on the Loader
  • Loading branch information
guybedford committed Apr 4, 2015
2 parents 924c0fd + 680e90a commit 88b1b09
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/transpiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
function getTranspilerModule(loader, globalName) {
return loader.newModule({ 'default': g[globalName], __useDefault: true });
}
// NB this does not support sub-classing well
var firstRun = true;

// use Traceur by default
Loader.prototype.transpiler = 'traceur';
Expand All @@ -17,12 +15,12 @@
var self = this;

// pick up Transpiler modules from existing globals on first run if set
if (firstRun) {
if (!self.transpilerHasRun) {
if (g.traceur && !self.has('traceur'))
self.set('traceur', getTranspilerModule(self, 'traceur'));
if (g.babel && !self.has('babel'))
self.set('babel', getTranspilerModule(self, 'babel'));
firstRun = false;
self.transpilerHasRun = true;
}

return self['import'](self.transpiler).then(function(transpiler) {
Expand Down Expand Up @@ -101,4 +99,4 @@
}


})(__global.LoaderPolyfill);
})(__global.LoaderPolyfill);

0 comments on commit 88b1b09

Please # to comment.