I am trying to use cesium within an application that also relies on requirejs.
Folder structure
/libs/cesium/1.12.0/Cesium.js
/src/scripts/packages/cesium-czml-viewer/1.0.0-pre/lenses/CesiumCzmlLensFactory.ts
/src/scripts/main.ts
I have a cesium shim
“Cesium”:{
exports:“Cesium”,
deps:[
“css!/libs/cesium/1.12.0/Widgets/widgets.css”
]
}
generated CesiumCzmlLensFactory.js has
define([“require”, “exports”, … “Cesium”, “template!../templates/CesiumLensTemplate.html”], function (require, exports, AscendClient, AscendUser, Cesium) {
…
CesiumCzmlLens.prototype.startCesium = function(){
var viewer = new Cesium.Viewer(…);
};
…
function CesiumCzmlLensFactory(blade) {
return new CesiumCzmlLens(blade);
}
return CesiumCzmlLensFactory;
}
cesium.js is loaded fine. but as soon as startCesium is triggered, then it tries to load all the assets relative to the modules path so getting not founds on /src/scripts/packages/cesium-czml-viewer/1.0.0-pre/lenses/Assets/… where all the assets is at the /lib/cesium/1.12.0/Assets/…
But if I in the application uses the console before the above module CesiumCzmlLensFactory is loaded and type require([“Cesium”], function(cesium){}); and then open the module everything works.
So concluding that Cesium is using the relative paths from where cesium module first is loaded which is not the normal behavior in requirjs/amd loaders. So could this be an error in the amd loader stuff injected into the builded/combined cesium.js file?
Are there a way to get around this? I do not want to use the source files.