Google Address Widget external javascript preventing deploy to cloud

I have created a widget which uses google address library When importing this in the define it works locally but will not compile for deployment in the cloud: define([ "dojo/base/declare", "mxui/widget/WidgetBase", "dijit/_TemplatedMixin", "mxui/dom", "dojo/dom", "dojo/dom-prop", "dojo/dom-geometry", "dojo/dom-class", "dojo/dom-style", "dojo/dom-construct", "dojo/_base/array", "dojo/_base/lang", "dojo/text", "dojo/html", "dojo/_base/event", "GoogleAddress/lib/jquery-1.11.2", "dojo/text!GoogleAddress/widget/template/GoogleAddress.html", "" ] The compilation error I am getting is: error(308) Failed to evaluate AMD define function. Is this due to security around an external javascript library? and is there a way to get a specified one cleared? Or is there a formatting issue in the define? Thanks Graham
1 answers

Hi Graham,

This is due to the way widgets are bundled through Dojo build. There is no way you can include an external library like that, dojo build will fail. This same issue we have had in the past and there is no simple way around it. If you want to include Google Maps, you should include it locally.

Luckily we have a way around this. Have a look at our Google Maps Widget. This includes a local copy of the JSAPI, which will load the Maps library (or any other that you like), for you.

  • JSAPI is included as a required dependency
  • This will create a global (window) variable google
  • google is used to load the Maps library