Refering to external library in Widget + Widget checker fails

Hi everybody, We are trying to incorporate the drawing library in a widget. We do this in the following way (not debating if this is the best way btw):   define([... "dojo/text!GoogleMapsDrawings/widget/template/GoogleMapsDrawings.html", "<<mykey>>&libraries=drawing", "GoogleMapsDrawings/lib/jsapi" ], function (declare, _WidgetBase, _TemplatedMixin, domStyle, domConstruct, dojoArray, lang, widgetTemplate, draw, googleDraw) { "use strict"; ...   When we do the widgetcheck, we keep getting errors on the https part (error log provides us with an ILLEGAL token. We have no idea what it could be. Checked all different kind of editors etc. So,  Could it be that it is not allowed to directly include a library like this when we deploy to the cloud? Localhost: everything works as designed this way. How should we include a library as stated above?   Hope you can help! Final bump to actual deploying it :-)   Cheers! Laurens
3 answers

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

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

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","<<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!