rblsb / khahotreload Goto Github PK
View Code? Open in Web Editor NEWHot reload for Kha/Haxe js targets
Hot reload for Kha/Haxe js targets
yo,
I followed the instructions, but I seem to get nothing but errors asking about a server. I even copied what I needed from the tasks.json
& launch.json
, but still errors.
the library is in the right folder as well
this is what pops up right away after the setup
> Executing task: node /usr/local/lib/kha/make debug-html5 --watch <
Using Kha (00520ec1, M Kinc, M Tools/khamake) from /usr/local/lib/kha
Creating Kha project.
(node:2348) UnhandledPromiseRejectionWarning: Error: Cannot find module '/Users/lepton/Developer/Kha/GAMES/OTO/server/bin/server.js'
Require stack:
- /usr/local/lib/kha/Tools/khamake/out/ProjectFile.js
- /usr/local/lib/kha/Tools/khamake/out/main.js
- /usr/local/lib/kha/Tools/khamake/out/khamake.js
- /usr/local/lib/kha/Tools/khamake/khamake.js
- /usr/local/lib/kha/make.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1020:15)
at Function.Module._load (internal/modules/cjs/loader.js:890:27)
at Module.require (internal/modules/cjs/loader.js:1080:19)
at require (internal/modules/cjs/helpers.js:72:18)
at eval (eval at <anonymous> (/usr/local/lib/kha/Tools/khamake/out/ProjectFile.js:52:17), <anonymous>:20:17)
at /usr/local/lib/kha/Tools/khamake/out/ProjectFile.js:52:144
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2348) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2348) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: khafile.js did not call resolve, no project created.
Terminal will be reused by tasks, press any key to close it.
so it bitches about the server & seems to be pointing not in the Library path, so I changed it so it goes right to server.js
& this is the next error
> Executing task: node /usr/local/lib/kha/make debug-html5 --watch <
Using Kha (00520ec1, M Kinc, M Tools/khamake) from /usr/local/lib/kha
Creating Kha project.
(node:2385) UnhandledPromiseRejectionWarning: TypeError: Server is not a constructor
at eval (eval at <anonymous> (/usr/local/lib/kha/Tools/khamake/out/ProjectFile.js:52:17), <anonymous>:22:17)
at /usr/local/lib/kha/Tools/khamake/out/ProjectFile.js:52:144
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2385) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:2385) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: khafile.js did not call resolve, no project created.
Terminal will be reused by tasks, press any key to close it.
& that's just a bit weird & don't know where to go next to fix it. I also saw about your black screen problem, so will get V6 once I figure out this problem first
I am using my own engine. but obviously still have the Main.hx
with main()
to put in the client stuff. but wondered if that's a problem. but seems a bit unlikely.
anyhow. hope you can help or shine some light on this
xxx
Hi, im trying to use this outside of vscode and i encounter this error:
Running server on 8080
Error: Port 8080 is already in use.
Please close the competing program (maybe another instance of khamake?)
or switch to a different port using the --port argument.
Using Kha (026dfc9f) from /home/brbl/Projects/CodeNect/libs/Kha
Creating Kha project.
Error: khafile.js did not call resolve, no project created.
node:internal/modules/cjs/loader:925
const err = new Error(message);
^
Error: Cannot find module 'libs/hotml/bin/server.js'
Require stack:
- /home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/ProjectFile.js
- /home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/main.js
- /home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/khamake.js
- /home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/khamake.js
- /home/brbl/Projects/CodeNect/libs/Kha/make.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at eval (eval at <anonymous> (/home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/ProjectFile.js:53:17), <anonymous>:16:17)
at /home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/ProjectFile.js:53:144
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:75:3) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/ProjectFile.js',
'/home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/main.js',
'/home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/out/khamake.js',
'/home/brbl/Projects/CodeNect/libs/Kha/Tools/khamake/khamake.js',
'/home/brbl/Projects/CodeNect/libs/Kha/make.js'
]
}
this is my khafile:
let project = new Project("CodeNect");
project.addSources("src");
project.addAssets("assets/DroidSans.ttf");
project.addAssets("assets/test.json");
project.addLibrary("libs/zui");
if (process.argv.includes("--watch")) { // run only in watch mode
let libPath = project.addLibrary('libs/hotml'); // client code for code-patching
project.addDefine('js_classic'); // to support constructors patching, optional
// start websocket server that will send type diffs to client
const path = require('path');
if (!libPath) libPath = path.resolve('libs/hotml');
const Server = require(`${libPath}/bin/server.js`).hotml.server.Main;
// path to target build folder and main js file.
const server = new Server(`${path.resolve('.')}/build/${platform}`, 'kha.js');
callbacks.postHaxeRecompilation = () => {
server.reload(); // parse js file every compilation
}
// for assets reloading
callbacks.postAssetReexporting = (path) => {
server.reloadAsset(path);
}
}
resolve(project);
the hotml
folder is in the libs/
folder. This is my command for running:
node libs/Kha/make html5 --server & node libs/Kha/make html5 --watch
server.reload();
server.reload();
CI: Run tests for Haxe 4.0.5 and git versions (4.1 in future)
Previously, everything worked and a little later it also worked, and then I updated the HAXE compiler to version 4.2.0 and the extension for VSCode, now nothing works (see screenshot)
Please help me to solve this problem and all the people of India will be grateful to you!
I tried to make a pull request but couldn't push to the remote.
Can we have a static reloads variable in hotml.client.Kha, like so:
public static var reloads:Int = 0;
which gets incremented every time reloadAsset is called?
This would allow me to keep track of how many reloads have occurs, and whether or not I need to reset or reload some state in my application.
With latest version of Kha, Haxe 4.2.2.
Old version of electron has bug described in this temp fix: Kode/Kha#1166
Another way to fix this problem before Kha Extension pack update: replace binary in .vscode/extensions/kodetech.electron-debug-18.11.1
manually (download version 6+ here)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.