1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Following symlinks when setting module.paths (fixes #2175)

This commit is contained in:
Trevor Burnham 2012-03-05 15:00:20 -05:00
parent 209a0f5a79
commit ef0cb46b9b
2 changed files with 2 additions and 2 deletions

View file

@ -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 {

View file

@ -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