Root script modules are not loaded

When a script module is loaded from a package, the ScriptPackage calls ScriptModule.loadModule() to initialise it.

However, if a root script module (e.g. ‘foo’ instead of ‘app.foo’) is added using ScriptManager.addScriptModule(), that module’s loadModule method will never be called, as it isn’t being loaded from a package. This means that no functions or properties are set on the module object so it’s empty until loadModule() is called manually.

I can see two possible fixes for this:

  1. Load root modules as soon as they are added. This is probably a bad idea. Error handling for this could be very difficult. Also, if this module depends on other modules it’s likely that they may not have been added yet.
  2. Change ScriptModule.findattr to load the module first if it has not already been loaded.

Thanks.

I’m gonna fix this using your second suggestion. I’m not sure this particular addScriptModule() call was ever meant to be exposed to 3rd parties, but let’s run with it and see what happens…

This appears to be fixed in 7.5.4.

Thanks.