Using the combined Build/Cesium.js instead of the individual .js files


I asked this question on Stack Overflow without much luck so I thought to try in here. I’ll repost the question, so for reference, the URL is:

I’ve been going around in circles trying to get the Cesium dependencies not to import when they’re imported from the “combined” Cesium.js.

I’ve got this code to a stage where it’s correctly finding the path of Cesium files, but it is loading up 100’s of them, instead of only the combined Build/Cesium.js and the CesiumViewerWidget (which doesn’t seem to be included in combined). e.g. One of the many files it loads is Source/Core/Clock.js which is built into Build/Cesium.js.

How can I tell dojo or CesiumViewerWidget to assume the core dependencies are already there?

I’m running this with Rails, hence the /assets/ path.

The code I’m working with:


baseUrl: ‘/assets/cesium/Source/Widgets’,

packages: [

// {name: ‘Cesium’, location: ‘…/…/Build/Cesium’},

{name: ‘Widgets/Dojo/CesiumViewerWidget’},

// {name: ‘dojo/on’, location: ‘dojo/on’},

// {name: ‘dojo/dom’, location: ‘dojo/dom’},

// {name: ‘dojo/io-query’, location: ‘dojo/io-query’}




‘dojo/on’, ‘dojo/dom’, ‘dojo/io-query’

], function(CesiumViewerWidget, on, dom, ioQuery) {




Hi Gerald,

If you’re using the combined JS file (Build/Cesium.js), you don’t need to use require at all. It exports a global Cesium variable.

However, if you want to use Cesium with Dojo, then loading lots of individual source files is the expected result, in development mode. The combined file is not built to work with Dojo, but instead is there to hide all of the modules, for users who aren’t interested in using an AMD module system in their application.

For deployment, you can then use the Dojo build system ( to produce layers containing all your application’s dependencies in one file. The Dojo build system is fairly complicated, but if you look in our build.xml file, you can see how we use the build system on the CesiumViewer application, producing minified, combined output in Build/Apps.

Let me know if that helps.



Looking into it after your advice, I’ve (basically) hacked CesiumViewerWidget so it refers to the Cesium object (e.g. Cesium.Scene instead of Scene) and removed the Cesium dependencies from the dojo require() call. This is a simple explanation of what I actually did, but that essentially solves the dependency problem.

Thanks for the help!