I am upgrading an older web map from 4.17 to 4.25 and don't have the time to rebuild with ES modules. I'm looking for a way to call dojo/query and esri/rest/query by different names using AMD modules.
Uncaught TypeError: query.executeQueryJSON is not a function
This error popped up after upgrading to 4.25 where the dojo library is no longed included with the CDN package. Assuming this is the reason because 4.24 still works.
Solved! Go to Solution.
Gotcha...I should have read slower...I have both in projects and I have the dojo/Query init function parameter set to 'query', and have the esri/rest/query parameter set to 'restQuery' -- then calling restQuery.executeQueryJSON works fine.
Sure...
require([
"esri/rest/query",
"dojo/query"
], function (
restQuery,
query
){
//esri restQuery call
restQuery.executeQueryJSON(){
});
}
You can still pull dojo in via the dojoConfig a 4.25+...
See here:
https://developers.arcgis.com/javascript/latest/release-notes/#removal-of-non-esri-packages-from-cdn
packages: [
{
name: "dojo",
location: "../../3.42/dojo"
},
{
name: "dijit",
location: "../../3.42/dijit"
}
]
Right, I am pulling it from another CDN but I get "Uncaught TypeError: query.executeQueryJSON is not a function" error and I am assuming my code is confusing dojo/query and esri/rest/query as I use both for the app.
Gotcha...I should have read slower...I have both in projects and I have the dojo/Query init function parameter set to 'query', and have the esri/rest/query parameter set to 'restQuery' -- then calling restQuery.executeQueryJSON works fine.
Thanks @MichaelSnook would you have an example of the code?
Sure...
require([
"esri/rest/query",
"dojo/query"
], function (
restQuery,
query
){
//esri restQuery call
restQuery.executeQueryJSON(){
});
}
Ah I see. So simple. Thanks!