Loading Cesium

What would be the preferred way to load Cesium in a production web site ? (ie minified build vs AMD).

If the preferred way is to use a minified build, what do you think of generating several js files:

  • A common loader,

  • One with the 2D support,

  • One with the 3D support.

This way we could only what’s required according to the client capabilities.

How I would use it is in fact not to load anything if the client does not support 3D (fallback to google maps for now).

Thanks for your suggestions,


For a production deployment, my recommendation is to use the AMD modules in your application, and then use an AMD build tool (RequireJS and Dojo are two that we’ve used) to create minified layer files that only include the parts of Cesium that your application needs, giving you the smallest files possible.

For example, for our NORAD Tracks Santa deployment, we are using the Dojo build system to create two different minified layer files: one that contains most of Cesium and runs the full Cesium map and one that only contains the CZML data processing modules, without any of the rendering code, which we are using to drive a separate page that shows videos as they become available. Even the layer that runs the map doesn’t actually contain all of Cesium; for example, we only need billboards and labels, so those modules are automatically excluded from the output.

I don’t think we should worry about splitting up the built Cesium file into multiple pieces. By splitting Cesium up into the AMD modules, we’ve already given users the ability to create their own layers that contain only those parts that they need. In my opinion, the pre-built Cesium.js file is great for people getting started, because you can easily get up and running, but any serious application should migrate over to using the modules.