如何将Haxe编译为JavaScript?

问题描述:

Grunt-Haxe大约在3年前建成。与NPM haxelib一起安装它,确实提供了一种编译纯JavaScript的方法,其中一个问题是无法利用JqueryExtern库;它每次尝试使用jQuery类时都会抛出一个错误,称它无法找到,即使添加了import jQuery.*。它使用Haxetoolkit编译* .Hx文件很好,但是它与haxe-NPM,haxelib,grunt-haxe不兼容,它只是在编译时忽略了JqueryExtern库。如何将Haxe编译为JavaScript?

这里是我的grunt配置 - 我有一些导致这些故障的东西吗?我使用haXe的版本是3.2.1 HAXE,我不能运行gulp watch因为它需要分配给HAXE一个任务,但不存在尚未

haxe: { 
     complete_example: { 
      main  : 'Main', 
      classpath: [ app.src.hx], 
      libs  : ['jQueryExtern' ], /*specify haxelib libraries */ 
      //flags : [ 'something', 'createjs' ], /* define conditional compilation flags */ 
      //macros : [ 'Mymacro.doSomethingCool()' ], /*call the given macro*/ 
      //resources: [ 'activity/xml/[email protected]_layout' ], /*define named resource files*/ 
      //misc  : [ '-debug', "--dead-code-elimination", "--js-modern" ], /* add any other arguments*/ 
      output : app.dest.js + 'hx.js', 
      onError : function (e) { 
       /*custom error message */ 
       console.log('There was a problem...\n' + e); 
      }, 
      force : true /*continue processing task (like --force)*/ 
     } 
    } 
grunt.loadNpmTasks('grunt-haxe'); 
+0

已经有一些[更改](https://github.com/HaxeFoundation/haxe/issues/4377)给JQuery包装器;你有什么版本的Haxe? –

+1

我自己并没有使用它,但是当hx文件改变时,你不能使用gulp-watch并调用'haxe build.hxml'吗?不知道这是否是你的问题,欢呼。 – TiagoLr

我能够编译它是唯一的出路通过使用用于intelliJ IDEA浏览器的文件观察器插件以及haxe工具包的正式版本。没有其他插件被发现做这项工作。