I’ve learned that dojo’s loader can load non-amd scripts, which is awesome. We have a script provided by a vendor that requires certain global variables to be set before the script can be loaded. If, in my AMD module, I set the global variables (I know, yuck, right?) and then require([“/vendor/script.js”]), everything works great.
The one thing I’m having trouble finding an answer to is if the build process will see this require call and add “/vendor/script.js” to the dependency list and build it. Which, if I understand correctly, will cause the script to fire before my module has had an opportunity to set the required global variables.
Can anyone tell me?
The default behavior is that the build will traverse the dependencies and include them in the build. However you have options:
1) in the profile, you can specify excludes. These will not be included into the build.
2) do not include the dependency in the define statement and use require later in the module.
dojo/fxdoes this withdojo/fx/toggler