Skip to content

Commit c4a3e17

Browse files
committed
Support for older revisions of Node.js for CoffeeScript.run()
1 parent dfd6025 commit c4a3e17

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/coffee-script.coffee

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ exports.run = (code, options) ->
5454
# Clear the module cache
5555
root.moduleCache = {} if root.moduleCache
5656
# Compile
57-
root._compile exports.compile(code, options), root.filename
57+
if path.extname(root.filename) isnt '.coffee' or require.extensions
58+
root._compile exports.compile(code, options), root.filename
59+
else
60+
root._compile code, root.filename
5861

5962
# Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).
6063
# The CoffeeScript REPL uses this to run the input.

0 commit comments

Comments
 (0)