Using Javascript libraries from node with Openfl Haxe

I need to be able to use Javascript libraries from node on an Openfl project that I’m programming using Haxe. Is there any guide or tutorial to follow?

For a Haxelib-based project:

  1. Use <dependency path="to/your/script.js" /> to copy a dependency script when targeting the browser
  2. Use https://haxe.org/manual/target-javascript-untyped.html or https://haxe.org/manual/target-javascript-external-libraries.html to reference the library

For an NPM-based project you can npm install then you might be able to pull the lilbrary in using require https://haxe.org/manual/target-javascript-require.html

1 Like