notebook: Notebooks 5.x breaks widget calls

We have developed our own custom widget that displays a map inside of a Jupyter Notebook. As part of that widget development, we use require.js for a few things. Prior to Notebooks 5.x, this has worked as expected. However, with Notebooks 5.1/5.2, we are now seeing poorly formed calls. For example, require.js used to make a call like the following:

http://js.arcgis.com/3.17amd/dijit/form/templates/TextBox.html?client=gsrs

And this works. However, with no changes in our Notebook widget call, the call now looks like:

http://js.arcgis.com/3.17amd/dijit/form/templates/TextBox.html.js?client=gsrs

It has appended a .js to the path. Has anyone seen this before? Can any suggest why this might be happening with the newer Notebook versions?

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Thanks @rohitgeo for that example. So, the simple way that I can get this to work is by just removing all of the requirejs text config along with the dojo/text mapping, so essentially just by using dojo/text as dojo & dijit expect.

The config call then looks like:

require.config({
    // Define path mappings for modules
    paths: {
        // [1] Modules hosted on Esri CDN.
        "dojo": esriCDN + "dojo",
        "dojox": esriCDN + "dojox",
        "dijit": esriCDN + "dijit",
        "esri": esriCDN + "esri",
        "dgrid": esriCDN + "dgrid",
        "xstyle": esriCDN + "xstyle",
        "put-selector": esriCDN + "put-selector",
        "moment": esriCDN + "moment",
    },
    urlArgs: "client=gsrs",
});

Was there a pressing reason that you wanted to use requirejs text instead of dojo’s?

I tried removing your moment path-config, in favour of using notebook’s builtin moment, but it appears some of your other cdn-hosted stuff is relying on finding things at moment/moment rather than the base moment defined in notebook. It also seemed that some cdn stuff may be doing some of the direct-requiring of moment locales I’ve tried to get rid of in #3048 (although I haven’t had time to dig into your require calls enough to see where that was coming from).

We’re providing RequireJS text 2.0.12. The config is what Bill had shared above.

do you know whether you’re actually going through a proxy?

We are not going through a proxy.

Ps, if it’s the requirejs text plugin, newer versions of notebook already bundle it (and moment had been included for some time), so you could skip loading from the CDN/nbextension path altogether