From ef0cb46b9bdd4e2105b432da70fc415f1e94c434 Mon Sep 17 00:00:00 2001 From: Trevor Burnham Date: Mon, 5 Mar 2012 15:00:20 -0500 Subject: [PATCH] Following symlinks when setting module.paths (fixes #2175) --- lib/coffee-script/coffee-script.js | 2 +- src/coffee-script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/coffee-script/coffee-script.js b/lib/coffee-script/coffee-script.js index 9e3aabfb..84325d37 100644 --- a/lib/coffee-script/coffee-script.js +++ b/lib/coffee-script/coffee-script.js @@ -68,7 +68,7 @@ mainModule = require.main; mainModule.filename = process.argv[1] = options.filename ? fs.realpathSync(options.filename) : '.'; mainModule.moduleCache && (mainModule.moduleCache = {}); - mainModule.paths = require('module')._nodeModulePaths(path.dirname(options.filename)); + mainModule.paths = require('module')._nodeModulePaths(path.dirname(fs.realpathSync(options.filename))); if (path.extname(mainModule.filename) !== '.coffee' || require.extensions) { return mainModule._compile(compile(code, options), mainModule.filename); } else { diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee index 0064534d..9f795f13 100644 --- a/src/coffee-script.coffee +++ b/src/coffee-script.coffee @@ -68,7 +68,7 @@ exports.run = (code, options = {}) -> mainModule.moduleCache and= {} # Assign paths for node_modules loading - mainModule.paths = require('module')._nodeModulePaths path.dirname options.filename + mainModule.paths = require('module')._nodeModulePaths path.dirname fs.realpathSync options.filename # Compile. if path.extname(mainModule.filename) isnt '.coffee' or require.extensions