【发布时间】:2013-01-02 02:32:17
【问题描述】:
使用 node.js 和 Haxe,有没有办法编写一个函数,从 Haxe 文件生成 node.js 模块,然后返回生成的模块?我开始使用 Haxe 编写 node.js 模块,我需要一种更轻松地导入模块的方法。
function requireHaxe(variableToRequire, haxeFileLocation){
//generate a JavaScript module from the Haxe file, and then return the generated JavaScript module
}
【问题讨论】:
-
这个问题应该不难解决——我只要想办法从node.js中运行Haxe编译器,获取生成的JavaScript文件名,然后导入生成的JavaScript 文件。
-
可以使用 Haxe 生成 node.js 模块,如下所述:groups.google.com/forum/#!topic/haxelang/6lzIeg6RUC4
-
在node.js中,也可以同步执行系统命令。 stackoverflow.com/questions/4443597/…
-
...这是我需要将 haxe 编译为 node.js 的 .hxml 文件。 github.com/fukaoi/HaxeNode/blob/master/compile.hxml