I have the following simplified project structure
|
|-app.js
|-components
| |
| |-someModule.js
my dojoConfig looks like this:
dojoConfig = {
async: true,
tlmSiblingOfDojo: false,
packages: [{
name: "components",
location: '/components'
}],
cacheBust: true
};
I am loading those files like this:
define(["esri/geometry/webMercatorUtils",
"esri/map",
"components/CoordinateTransutils",
"components/SettingsManager"
],
function(WebMercatorUtils, Map, CoordinateTransUtils, SettingsManager) {
}
);
locally I am developing using nodes http-server
, which does work fine. Deployed on IIS however I am receiving errors which do look like this:
Failed to load resource: the server responded with a status of 404 (Not Found)
init.js:41 Error: scriptError
at d (init.js:15)
at HTMLScriptElement.<anonymous> (init.js:40)
(anonymous) @ init.js:41
init.js:41 src: dojoLoader
init.js:41 info: Array(2)0: "/components/CoordinateTransUtils.js?1496989376094"1: Eventlength: 2__proto__: Array(0)
The problem at hand is: why is it working on a local dev server, but not on IIS?
I use something like this:
var dojoConfig = (function () {
var base = location.href.split("/");
base.pop();
base = base.join("/");
return {
async: true,
isDebug: true,
packages: [{
name: "components",
location: base + "/components"
}]
};
})();
and it works without problem both locally and on IIS server.