Skip to content

Commit

Permalink
Merge pull request #98 from tschaub/unmodified-extensions
Browse files Browse the repository at this point in the history
Only add .coffee to extensions if it was present before
  • Loading branch information
jhnns authored Jul 1, 2016
2 parents f126dcb + 5561b8e commit c0694e4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/moduleEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,17 @@ function requireProxy(path) {
}

function registerExtensions() {
originalExtensions.coffee = require.extensions[".coffee"];
var originalCoffeeExtension = require.extensions[".coffee"];
if (originalCoffeeExtension) {
originalExtensions.coffee = originalCoffeeExtension;
}
require.extensions[".coffee"] = coffeeExtension;
}

function restoreExtensions() {
require.extensions[".coffee"] = originalExtensions.coffee;
if ("coffee" in originalExtensions) {
require.extensions[".coffee"] = originalExtensions.coffee;
}
}

function coffeeExtension(module, filename) {
Expand Down

0 comments on commit c0694e4

Please sign in to comment.