Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom haxe path #10

Open
francescoagati opened this issue Oct 6, 2017 · 9 comments
Open

custom haxe path #10

francescoagati opened this issue Oct 6, 2017 · 9 comments

Comments

@francescoagati
Copy link

hi,
is possible use a custom path for the haxe compiler in the webpack config?

@elsassph
Copy link
Collaborator

elsassph commented Oct 6, 2017

It currently uses haxe from the PATH.

An option could be added but then it is user/platform specific so the config isn't the right place for that. Haxe doesn't suggest a standard way to handle that.

@jasononeil has started looking into using Haxe from npm - that makes it crossplatform. We should use it if it's specified in the package.json.

@francescoagati
Copy link
Author

thanks

@elsassph
Copy link
Collaborator

elsassph commented Oct 6, 2017

The other problem of using Haxe from npm is that we need to use haxelib from npm - quite a serious change of workflow.

@francescoagati
Copy link
Author

yes can be a big change. maybe the custom path can be another idea?

@elsassph
Copy link
Collaborator

elsassph commented Oct 6, 2017

Maybe support a user "rc" file, but we'd like to stick to something relatively standard...

@elsassph
Copy link
Collaborator

elsassph commented Oct 6, 2017

(also maybe I'm wrong about the requirement to use haxelib from npm)

@jasononeil
Copy link
Owner

@elsassph @francescoagati I've been thinking about this some more, and the two tools I know of to load Haxe through NPM are https://yarnpkg.com/en/package/haxe and https://yarnpkg.com/en/package/haxeshim

Both of these install the "binaries" to node_modules/.bin/haxe and node_modules/.bin/haxelib, and both of them handle the path between haxe and haxelib. (Well, haxeshim pretty much removes the need for haxelib, but you get my point).

So theoretically we could just change the loader to detect if haxe is available in node_modules/.bin/haxe, and if it is, use the local haxe rather than global haxe.

We could make it configurable as a string (take any path), as a "preferLocal" or "preferGlobal" boolean flag, or just have default behaviour to prefer local if available.

What do you think about that approach?

@francescoagati
Copy link
Author

i think that the haxe path can be simple passed as parameter of haxe loader in the webpack config.
we need only expose this part as a parameter https://github.com/jasononeil/webpack-haxe-loader/blob/master/index.js#L34

@jasononeil
Copy link
Owner

I've just realised that any haxe installation used via NPM (so either https://www.npmjs.com/package/haxe or https://www.npmjs.com/package/haxeshim) will install to node_modules/.bin/haxe, and by default both npm run webpack and yarn webpack will have this on the path.

What this means is that you can be in an environment without haxe installed (or with an existing, incorrect version of haxe installed), and it will install a local haxe as part of installing NPM dependencies, and use that during the webpack build, with no extra change to the code necessary.

I'll leave this issue open and mark it as "help wanted", because I think it's still worth having a configurable option, but at least using NPM packages is a suitable path forward for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants