Is there something in Oracle Jet that allows you to include a JavaScript file inside another JavaScript file?
I have my first.js
with a lot of functions that I'd like to use in other js pages without copy and paste.
I found this question in pure javascript and in particular the John Strickler's answer con match because Oracle Jet use Require Js.
But I have problem with loading my page after I have included first page in define.
I'd like to have my functions in appController/main js and can use in all other modules but I don't know if it is possible.
Thank you.
Oracle JET uses requireJS for loading modules (and files) dynamically.
Documentation can be found on: https://requirejs.org/
What you will need to do to is "transform" your
first.js
file to a module "format" so that RequireJS can load it and "expose" your functions. Check the documentation for more info: https://requirejs.org/docs/api.html#defineIf you have done that, you can use your module anywhere you want and thus don't need copy/pasta.