Hi Martijn,
here is an example project which includes a custom Javascript file: 0101-51_Custom_js.zip
The main trick is to add the CUSTOM "library" in Expert settings in HMI Designer. The GENERAL library must be added as well:
0_1583833486862_rexygen-hmi-custom-javascript.png
The "library" CUSTOM is located in the hmisrc folder and it has to have a "js" subfolder which contains your Javascript files. These are then included in the generated HMI files.
Hope this helps, let me know.
Best regards
Jaroslav