Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/moduleEnv.js')
-rw-r--r--lib/moduleEnv.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/moduleEnv.js b/lib/moduleEnv.js
index a9f410a..2f9743c 100644
--- a/lib/moduleEnv.js
+++ b/lib/moduleEnv.js
@@ -89,6 +89,10 @@ function jsExtension(module, filename) {
}
function coffeeExtension(module, filename) {
+ if (!coffee) {
+ throw new Error("please add 'coffeescript' to your devDependencies");
+ }
+
var content = stripBOM(fs.readFileSync(filename, "utf8"));
restoreExtensions();
@@ -113,9 +117,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 coffee-script support, but that's ok as long as the user doesn't want it.
+ }
}
exports.load = load;