A Vite plugin for integrating CesiumJS into Vite projects. It externalizes Cesium.js and its CSS, copies the Cesium static assets to the output directory, and sets CESIUM_BASE_URL automatically. Current stable version is 0.7.4, supports Vite 5 through 8, and ships TypeScript types. Compared to other Cesium Vite plugins (e.g., vite-plugin-cesium), this plugin offers faster builds by not processing Cesium through Vite's bundler, supports @cesium/engine, and provides fine-grained control via options like iife, css, customCesiumBaseUrl.
npm install vite-plugin-cesium-buildVerified import paths — ran on the pinned version, not inferred.
Shows the minimal setup to add CesiumJS support to a Vite project using the default plugin.
If using core methods (imports, setBaseUrl), review the changes in v0.5.0 and adjust your configuration.
Ensure your Cesium assets are served with appropriate CORS headers, or set customCesiumBaseUrl to handle cross-origin manually.
Set iife:true (default) for automatic script injection, or manually import Cesium in your application code if iife:false.
Always set css:true if you want Cesium CSS to be included. In future, the plugin may auto-detect.
Use `import cesium from 'vite-plugin-cesium-build/engine'` when your project uses @cesium/engine.
Set the 'from' option to the correct path where Cesium's Build/Cesium folder exists, e.g., cesium({ from: 'node_modules/cesium/Build/Cesium' })Use `import cesium from 'vite-plugin-cesium-build'` (default import) instead of `import { cesium } from 'vite-plugin-cesium-build'`.Ensure the Cesium static assets (Cesium.js, widgets.css) are copied correctly to the output directory and the script tag is present in index.html. Check network tab for 404 errors.
Install @cesium/engine and ensure you are using vite-plugin-cesium-build >=0.4.0.