vite-plugin-earth
v2.5.0
Published
Cesium & Mars3D library plugin for Vite
Downloads
9
Readme
⚡ vite-plugin-earth
Easily set up a Cesium
& Mars3D
project in Vite
.
Cesium
Install
npm i cesium vite-plugin-earth vite -D
Usage
add this plugin to vite.config.js
import { defineConfig } from 'vite';
import { cesiumPlugin } from 'vite-plugin-earth';
export default defineConfig({
plugins: [cesiumPlugin()]
});
Mars3D
Install
npm i mars3d mars3d-cesium vite-plugin-earth vite -D
Usage
add this plugin to vite.config.js
import { defineConfig } from 'vite';
import { mars3dPlugin } from 'vite-plugin-earth';
export default defineConfig({
plugins: [mars3dPlugin()]
});
Options
useCDN
- Type :
object
- Default :
{ mars3d: 'latest', mars3dCesium: 'latest', turf: '6.5.0' }
打包时使用 cdn 方式
import { defineConfig } from 'vite';
import { mars3dPlugin } from 'vite-plugin-earth';
export default defineConfig({
plugins: [
mars3dPlugin({
useCDN: true
})
]
});
Demo
Cesium
<div id="cesiumContainer"></div>
import { Viewer } from 'cesium';
const viewer = new Viewer('cesiumContainer');
Mars3D
<div id="mars3dContainer"></div>
import * as mars3d from 'mars3d';
import 'mars3d/dist/mars3d.css';
const map = new mars3d.Map('mars3dContainer', {});
License
MIT