I would recommend checking out some other widgets in the app store to see how they load external libraries:
For example d3TreeView widgets packages a copy of the external javascript library together with the widget under a lib folder and then references it with
"D3TreeView/lib/d3-v3-min"
https://github.com/ivosturm/D3TreeView/blob/master/src/D3TreeView/widget/D3TreeView.js
I have personally loaded external libs in the postCreate method. If you use this approach you need to set the loaded flag so that mendix knows when your widget is ready see https://apidocs.mendix.com/7/client/tutorial-widget-lifecycle.html
Hope this helps
Hello both,
A bit of a late reply as I've been tackling this issue the last few days myself - I found that you can include HTTP/HTTPS libraries through the Dojo AMD loader, but you cannot use them in the Define statement as they get marked as invalid for the cloud.
What you can do is is add them in the require statement, that way you cannot directly reference the js package in your declare statement but you can use any keywords and libraries defined within the js.
i.e. require(["GoogleMapsDrawings/widget/widget/GoogleMapsDrawings/widget","https://maps.googleapis.com/maps/api/js?key=<<mykey>>&libraries=drawing""]);
Hope this is of some use!
Discovered something interesting (thanks to the reply by Andrej). If i refer directly to the library using the http statement in define, it works locally but not in the cloud. When I download the library and use the reference, it works locally AND in the cloud. Now I'm not sure if this remains functional but lets see how it goes.
Kind regards!
Laurens