Confirmation about the npm targets (js, type script, haxe)

Currently there are now 2 ways to target html5 in haxe, original lime build html5, and the new npm start. I’m curious if both of these targets will eventually be merged down the line or have different uses for instance interactive projects I’d probably use original method but a native website I’d 100% use npm since you have alot of js libaries to acsess and use. Also npm project being able to use haxelibs out of the box a possibility or is openfl waiting for a new haxe package manager approach? Thanks for reading this cheers.

There’s definitely a difference in approach:

Haxelib

  • Project files are designed to always support cross-platform
  • Applications are always built from source (no CommonJS modules)
  • The output directory is (potentially) blown away each build, it is not intended to be edited

NPM

  • Project files are very specifically browser or Node.js only
  • package.json, webpack.config.js and other files are meant to be edited
  • npm install is expensive, and remove npm link directories

We currently pre-compile JavaScript (either a single openfl.min.js or separate JS modules) in the NPM version. Applications are not rebuilding OpenFL or Lime, ever, and the Lime API is not available. Since Lime and OpenFL are not rebuilt, there is no support for compiler defines to change the behavior of the source (though it could affect Haxe-based application sources)

I see convergence occurring in the future, but I’m not yet sure exactly how that might work. For one, we would want to test if node_modules is up-to-date. One idea would be running npm install if a project uses a package.json, but only if node_modules does not exist yet. A partial install would require -clean for us to re-run npm install.

There are certainly features I like about the NPM version on the web, like hot-reloading while making changes is great :wink:

1 Like