I have a project with a standard “modules” folder. I also want to put some modules in a “common/modules” folder, which resides off of the root of my project.
My coldbox.cfc file has this line in it:
modulesExternalLocation = [“common/modules”],
This mostly works, as the module is found and loaded correctly. However, it doesn’t seem to be accessible. When I try and use functions within its model, I get errors.
When I do a dump of the modules registry, it has the correct physical path. The invocation path is simply “common.modules” whereas my other modules in the standard modules folder show up as “myApp.modules”. I think the invocation path should be “myApp.common.modules”, but I’m not totally sure what is expected here.
Has anyone else seen this, and is there a way to get this working?
The external locations directive assumes the mapping is absolute to the root. This way you could have a shared modules resource with a server mapping while running multiple Coldbox Apps. If you want the module path mapping to be myApp.common.modules, then you would need your external location array item to be “myApp/common/modules”
Thanks for the reply. I thought that would be the case as well, and tried that. It doesn’t seem to work. If I dump the moduleServices structure, I can see that the modulesExternalLocation value is correct, but it is not loading my module in that location. If I move that module to the standard “modules” folder, it works just fine. I’ll play around with it a bit more to see if I’m missing something obvious.
I think I figured it out. I changed modulesExternalLocation to be “/myApp/common/modules” (note the forward slash at the beginning) and it works.