unplugin-cesium
TypeScript icon, indicating that this package has built-in type declarations

3.0.3 • Public • Published

unplugin-cesium NPM version

English | 简体中文

Quickly integrate CesiumJS into various bundlers.

Features

  • ✨ Support Vite, Webpack, Vue CLI, Rspack, Rollup, esbuild and more, powered by unplugin.
  • ⚡️ No need to wait for Cesium static files to be copied in Vite development mode
  • 🦾 Full TypeScript support.

Install

# npm
npm i unplugin-cesium -D

# pnpm
pnpm i unplugin-cesium -D

# yarn
yarn add unplugin-cesium -D

Example

Vite

// vite.config.ts
import UnpluginCesium from 'unplugin-cesium/vite'

export default defineConfig({
  plugins: [
    UnpluginCesium({ /* options */ }),
  ],
})

Vue CLI

// vue.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-cesium/webpack').default({ /* options */ }),
  ],
}

Webpack

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-cesium/webpack').default({ /* options */ }),
  ],
}

Rsbuild

// rsbuild.config.ts
import UnpluginCesium from 'unplugin-cesium/rspack'

export default defineConfig({
  tools: {
    rspack: {
      plugins: [
        UnpluginCesium({/* options */}),
      ],
    },
  },
})

Options

export interface UnpluginCesiumOptions {
  /**
   * This is the base URL for static files that CesiumJS needs to load.
   * If you have configured a CDN URL for these static files, you can also directly specify the CDN URL and set `copyStaticFiles` to `false`.
   * @default '/cesiumStatic'
   */
  cesiumBaseUrl?: string

  /**
   * If you have set a similar `base` in vite or `publicPath` in webpack, you also need to set the same parameter here.
   * @default '/'
   */
  base?: string

  /**
   * Whether to copy static files to the `cesiumBaseUrl` directory.
   * @default true
   */
  copyStaticFiles?: boolean
}

Package Sidebar

Install

npm i unplugin-cesium

Weekly Downloads

28

Version

3.0.3

License

MIT

Unpacked Size

25.3 kB

Total Files

53

Last publish

Collaborators

  • xiankq