How to import installed package to project


I would like to import to project this package exceljs-hx (0.14.0) . I have already installed it and used in build.hxml -lib exceljs-hx

but I dont know how to call their functions. Can you suggest me anything, please?

Thank you so much

The js version on github contains a lot of information: GitHub - exceljs/exceljs: Excel Workbook Manager
Since they are externs the api should be near identical, otherwise you’ll have to check the source code.

Thank you for you reply, I moved forward but after whole hours I didnt find right solution.

What i did now is, I remove -lib exceljs-hx from my build.hxml file and I only download all library and copy to my source code. I did couple of fixes because there was used variable “operator” at which compiler throw me exception because in hx 4 its already reserved keyword.

After this fixes i did simple call of static function exceljs.Main.main(); compiler was successful but in google console it throws me now: “ReferenceError: Can’t find variable: require”. I cant find solution how to fix it/added something. The class called in exceljs.Main.main(); contains @:jsRequire(“exceljs”, “Workbook”) and its extern class. I tried do many exercises but failed

Thanks for all replies

By including requirejs library i fixed previously problem. But unfortunately i am getting this error right now from RequireJS:
Error: Module name “exceljs” has not been loaded yet for context: _. Use require([])

I have installed it and in my haxe $path next to others one libraries but i am not using it on build.hxml only i just copy all those files to my project directory and doing direct call of their functionalities. But it seems by error message above that something is wrong :confused:

You need to install the ExcelJS module (Node.js), as exceljs-hx is just an Haxe extern for it.

Thank you for your reply!

I already installed this npm module to my project. I see new installed files in node_modules but still not working. I am trying to include generated files from node_modules but still failed.

There’s really no video or any instructions which can use or learn from them?

Thank you so much you hint, i think it was just another step to finish this stuf

Here is a sample of haxe dealing with npm GitHub - elsassph/haxe-react-redux: Demonstrates Haxe React + Redux, code-splitting and hot-reload

1 Like

This blog post should be useful: Using NPM modules from Haxe |