diff options
Diffstat (limited to 'lib/moduleEnv.js')
-rw-r--r-- | lib/moduleEnv.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/moduleEnv.js b/lib/moduleEnv.js index 688401e..599e332 100644 --- a/lib/moduleEnv.js +++ b/lib/moduleEnv.js @@ -133,6 +133,10 @@ function jsExtension(module, filename) { } function coffeeExtension(module, filename) { + if (!coffee) { + throw new Error("Cannot rewire module written in CoffeeScript: Please install 'coffeescript' package first."); + } + var content = stripBOM(fs.readFileSync(filename, "utf8")); restoreExtensions(); @@ -157,9 +161,14 @@ function stripBOM(content) { } try { - coffee = require("coffee-script"); + coffee = require("coffeescript"); } catch (err) { - // We are not able to provide coffee-script support, but that's ok as long as the user doesn't want it. + try { + // Trying to load deprecated package + coffee = require("coffee-script"); + } catch (err) { + // We are not able to provide CoffeeScript support, but that's ok as long as the user doesn't want it. + } } exports.load = load; |