2015-10-13 40 views
2

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

回答

0

我能夠編譯它是唯一的出路通過使用用於intelliJ IDEA瀏覽器的文件觀察器插件以及haxe工具包的正式版本。沒有其他插件被發現做這項工作。