vite-plugin-gvemap

raw JSON →
1.1.15 verified Mon Apr 27 auth: no javascript

A Vite plugin that simplifies integrating the gvemap (Cesium-based) library into Vite projects. Version 1.1.15, actively maintained. It handles Cesium static assets, worker files, and module resolution. Key differentiators: automatic copy of Cesium assets to build output, optional rebuild from source, and seamless Cesium import. Requires gvemap ^1.1.1 and Vite >=2.7.1, ships TypeScript types.

error Failed to resolve import "cesium" from "src/index.js". Does the file exist?
cause Cesium package not installed or not in node_modules.
fix
Install cesium: npm install cesium
error TypeError: cesium is not a function
cause Using default import instead of named import when plugin expects a default export.
fix
Use import cesium from 'vite-plugin-gvemap' (default) not import { cesium } from 'vite-plugin-gvemap'.
error The 'cesium' package could not be found. Make sure it is installed.
cause The plugin tries to resolve 'cesium' but it's missing.
fix
Install cesium as a dependency.
error [vite] Build failed with 1 error: ENOTDIR: not a directory, copyfile '.../node_modules/cesium/Build/Cesium/Cesium.js'
cause The 'cesium' package may be installed incorrectly or has a different structure.
fix
Reinstall cesium: npm reinstall cesium
gotcha The plugin copies Cesium static assets from node_modules/cesium to the public directory at build time. If you delete or modify those assets manually, the build may break.
fix Do not manually alter node_modules/cesium; rely on the plugin's automatic copy.
gotcha When using `rebuildCesium: true`, the plugin rebuilds Cesium from source, which requires additional build tools (e.g., Node.js, rollup) and significantly increases build time.
fix Only enable rebuildCesium if you need custom Cesium modifications; otherwise keep default false.
deprecated The option `cesiumPath` was removed in v1.1.0. Previously you could specify a custom path to Cesium; now the plugin uses the 'cesium' package from node_modules.
fix Remove any `cesiumPath` option; ensure 'cesium' is installed as a dependency.
gotcha The plugin expects the 'cesium' package to be installed, not the 'gvemap' package directly (gvemap is the package name but it re-exports cesium). Make sure you install 'cesium' as a dependency.
fix Run `npm install cesium` or `yarn add cesium`.
npm install vite-plugin-gvemap
yarn add vite-plugin-gvemap
pnpm add vite-plugin-gvemap

Minimal Vite configuration to add the gvemap plugin, enabling Cesium GIS support in a Vite project.

import { defineConfig } from 'vite';
import cesium from 'vite-plugin-gvemap';

export default defineConfig({
  plugins: [cesium()]
});