【发布时间】:2014-12-25 00:34:17
【问题描述】:
我有 3 个文件,一个作为 main.coffee 和 2 个其他文件:具有不同功能的 file1.coffee 和 file2.coffee。我想在我的主文件中使用该函数(包括在 C 中)
主咖啡
exemple1 = function1fromfiles1("hello")
exemple2 = function1fromfiles2("hello")
file1.coffee
function1fromfiles1=(word)->
console.log "file1"+word
return true
file2.coffee
function1fromfiles2=(word)->
console.log "file2"+word
return true
我尝试使用 require 但我收到错误消息:
ReferenceError: function1fromfiles1 is not defined
at Object.<anonymous> (/Users/admin/Documents/workspace/node/file1.coffee:3:1)
at Object.<anonymous> (/Users/admin/Documents/workspace/node/file1.coffee:1:1)
at Module._compile (module.js:456:26)
如果有人可以帮助我?谢谢你
【问题讨论】:
标签: javascript node.js coffeescript include require