I have a framework which uses Kha and a project that uses that framework.
How can I include assets which need to be setup in the framework and append it to the project?
In other words, something like a khafile.js for the engine and other for the project which can "includes" the framework khafile.js.
-
Inherit other lib khafile.js configuration
-
Inherit other lib khafile.js configuration
I'm trying to do exactly this right now, but am running into issues. Since I want to include things (as resources) from the library, I need to add compiler defines which point to the resource location. In order to get where the library is installed, I want to parse the results of
haxelib list
, basically doing:var results = require('child_process').execSync('haxelib list').toString();
The problem is that no matter what I do, I can't get it to execute like normal nodejs—it doesn't have the
require
function:Creating Kha project. undefined:3 var results = require('child_process').execSync('haxelib list').toString(); ^ ReferenceError: require is not defined at eval (eval at <anonymous> (C:\HaxeToolkit\haxe\lib\kha\git\Tools\khamake\ProjectFile.js:10:16), <anonymous>:3:15) at module.exports (C:\HaxeToolkit\haxe\lib\kha\git\Tools\khamake\ProjectFile.js:10:47) at exportKhaProject (C:\HaxeToolkit\haxe\lib\kha\git\Tools\khamake\main.js:494:13) at exportProject (C:\HaxeToolkit\haxe\lib\kha\git\Tools\khamake\main.js:618:10) at Object.exports.run.callback [as run] (C:\HaxeToolkit\haxe\lib\kha\git\Tools\khamake\main.js:731:9) at Object.<anonymous> (C:\HaxeToolkit\haxe\lib\kha\git\Tools\khamake\khamake.js:285:23) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12)
Since I can't require any modules, I can't really do much as the entire node standard library relies on requiring things.
Is there any way to resolve this?
Thanks!