编译没有Main类的Haxe库

bgu*_*uiz 2 compiler-errors haxe

我正在Haxe写一个不暴露"Main"类的库.相反,它只包含typedef和类,它们用于包含此库的其他应用程序.

如果我尝试编译没有-main选项,我会收到以下错误:

Haxe Compiler 3.2.1 - (C)2005-2015 Haxe Foundation
 Usage : haxe -main <class> [-swf|-js|-neko|-php|-cpp|-as3] <output> [options]
Run Code Online (Sandbox Code Playgroud)

Haxe编译器是否阻止您编译没有入口点的库?


Cam*_*ata 7

你可以在没有main的情况下使用类似下面的build.hxml进行编译:

-cp src 

# add the package(s) that you want to include the following way: 
--macro "include('package1.foo')"
--macro "include('package2.bar.test.buz')"
...

-js bin/index.js
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助!