diff options
author | Johannes Ewald <johannes.ewald@peerigon.com> | 2015-04-28 00:39:19 +0300 |
---|---|---|
committer | Johannes Ewald <johannes.ewald@peerigon.com> | 2015-04-28 00:39:19 +0300 |
commit | 88f6024b9ed4b733ec652e9c8317f9afc7a2c76d (patch) | |
tree | 44c7119225ee157edce77cbec4456cc67cf610ab /lib | |
parent | 52c3a6912abfbad1ac626972be03baeabe5bdfa1 (diff) |
Try to require coffee-script on start-up
Diffstat (limited to 'lib')
-rw-r--r-- | lib/moduleEnv.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/moduleEnv.js b/lib/moduleEnv.js index d17918b..074b5f3 100644 --- a/lib/moduleEnv.js +++ b/lib/moduleEnv.js @@ -1,7 +1,8 @@ "use strict"; var Module = require("module"), - fs = require("fs"); + fs = require("fs"), + coffee; // caching original wrapper var moduleWrapper0 = Module.wrapper[0], @@ -55,8 +56,7 @@ function restoreExtensions() { } function coffeeExtension(module, filename) { - var coffee = require("coffee-script"), - content = stripBOM(fs.readFileSync(filename, "utf8")); + var content = stripBOM(fs.readFileSync(filename, "utf8")); content = coffee.compile(content, { filename: filename, @@ -78,5 +78,11 @@ function stripBOM(content) { return content; } +try { + 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; -exports.inject = inject;
\ No newline at end of file +exports.inject = inject; |